*Create repository classes from business entities issue - urgent please*

Sep 7, 2007 at 6:03 PM

I created a User Table in Database, and then I created the Business Entity Class for it.
I created CRUD stored procedures, and ran them against the database (SQL Server 2000).

I am getting the following error when I select "Specify mapping between entities and stored procedures" from "Create data repository classes from business entities" wizard:

"There was an error trying to obtain the list of stored procedures."

After 5 days of trying all possible potential solutions that I could think of, I decided to format my computer and install all the softwares again, eventually it's fixed :)

Best regards
Sep 8, 2007 at 5:46 AM
While I'm glad you got it working, that's not the kind of workaround I'd recommend for general use.

If it happens again, please let us know before your reformat and hopefully we can do a little troubleshooting.
Oct 15, 2008 at 5:32 AM
Edited Oct 15, 2008 at 5:35 AM
As it happens i am getting this issue on a particular database, not all my databases do this...  Any thoughts would be appreciated.

P.S.  I f i ignore the message and try to add Get All, the windows exit without warning. Without displaying the list of stored procedures available.
Oct 16, 2008 at 2:30 AM
Hi Adam,

Unfortunately, I am not able to duplicate this error, but I will try to provide you some information of what can cause this error message.

The message above is displayed when an exception is thrown in ProvideDefaultMappings (Data Access Guidance Package\CustomPages\EntitySPMapperCP.cs). An exception can happen if you select a class that is not mapped to a database table or if a stored procedure does not exist. If you recently made any changes to your database, make sure to regenerate the business entities classes and stored procedures to match the latest database schema. You will also need to rerun the stored procedure script. I changed the code to display a more informative message which includes the names of missing stored procedures. This new code is available on change set # 23612.

Another thing to look at is the rcpstate file. The first time you create the repository classes, it will present you a default mapping and it will allow you to change it. When you are done, this information will be persisted in your solution directory in the file named <solution_name>.rcpstate. Next time you create repository classes, it will read the mappings from the rcpstate file. I am just wondering if you could rename your rcpstate file to something else and recreate the repository class. I am just wondering if the mapping information stored in your rcpstate file is incorrect and it is causing ProvideDefaultMappings to throw an exception.

Finally, I suggest you to debug to find where this exception is thrown (see link to how to debug in the home page). You can add a break point at exception handling code of SetControlProperties method located in Data Access Guidance Package\CustomPages\EntitySPMapperCP.cs:

                ProvideDefaultMappings(clonedEntities, UIHelper.GetStoredProcedures(connectionSettings));
            catch (Exception ex)
                IUIService uiService = (IUIService)GetService(typeof(IUIService));

Check the ex.StackTrace and ex.Message to get more details about the problem and let us know what you are getting.

I hope this helps and let us know how goes.

Jan 15, 2009 at 11:17 AM
I have also found that this error will occur if the Repository Factory (RF) is unable to "analyse" your stored procedures defined in the .rcpState file.

For example, I have two SPs that have some T-SQL at the beginning which create a temporary table to be used later in the SP. This seems to "confuse" RF, causing either an error or for RF to simply close without any errors.

So, for example, in my delete SP I have added a dummy DELETE statement at the beginning, e.g.

DELETE FROM tblIncident WHERE 1=0

In the other SP - a Get Many SP - I have to comment out the temporary table T-SQL to ensure that the SELECT statement is the first operation, otherwise RF won't work.

I suppose the assumption by RF is that your SPs perform atomic operations and have probably been generated by RF.

I hope this helps.