- Home
- LLBLGen Pro
- LLBLGen Pro Runtime Framework
Entity Factory to select doesn't appear in Visual Studio designer
Joined: 25-Nov-2007
Hello, I am using LLBLGenPro version 2.6 (Final June 6, 2006) and the database is Oracle 11. The runtime version of the ORMSupportClasses.NET20 is v2.0.50727 and the version is 2.6.0.0.
I am using Adapter when I generate the data access layer and C# with Visual Studio 2005.
I have tried to configure the datasource in the designer of Visual Studio 2005. Although I see the Data Access Adapter and Container Type, the Entity factory to Select drop down box is empty. I see factory classes listed in the code in the DatabaseGeneric classes that are generated.
I have tried manually adding the Entity factory in the .aspx class, but at runtime I then get an error. The Stack trace is below, and this is my entry in the .aspx class:
<llblgenpro:LLBLGenProDataSource2 ID="_tapStudentEntityDS" runat="server" LivePersistence="False" AdapterTypeName="cctc.DatabaseSpecific.DataAccessAdapter, cctcDBSpecific" DataContainerType="EntityCollection" EntityFactoryTypeName="cctc.FactoryClasses.TapStudentTbEntityFactory, cctc" > </llblgenpro:LLBLGenProDataSource2>
I have spent quite a while checking references and making sure I am using the same .NET20 class in the Toolbox when I select the LLBLGenProDataSource2. I have also checked the database to make sure I have a primary key set and that the fields are not set to read only. I have connected to the Oracle database successfully in a different project, so I am puzzled why I am not able to select the Entity Factory in the designer.
I am using a grid view with the data source, and also tried manually entering the data keys in the properties of the grid view.
Thanks for any suggestions! Carol
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] SD.LLBLGen.Pro.ORMSupportClasses.LLBLGenProDataSourceView2.ExecuteSelectEntityCollection(Int32 pageSize, Int32 pageNumber, DataSourceSelectArguments arguments) +162 SD.LLBLGen.Pro.ORMSupportClasses.LLBLGenProDataSourceView2.ExecuteSelect(DataSourceSelectArguments arguments) +358 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +19 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +142 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +73 System.Web.UI.WebControls.GridView.DataBind() +4 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +72 System.Web.UI.Control.EnsureChildControls() +87 System.Web.UI.Control.PreRenderRecursiveInternal() +44 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Control.PreRenderRecursiveInternal() +171 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
Version Information: Microsoft .NET Framework Version:2.0.50727.3620; ASP.NET Version:2.0.50727.3618
You are using LiverPersistance=false. That means you are implementing event handlers for PerformSelect, PerformDBCount and PerformWork. Do you? Could you post the code for the PerformSelect?
(Edit)
cgray wrote:
I have tried to configure the datasource in the designer of Visual Studio 2005. Although I see the Data Access Adapter and Container Type, the Entity factory to Select drop down box is empty. I see factory classes listed in the code in the DatabaseGeneric classes that are generated
Please try to clean/recompile the DBGeneric project. It's also recommended you install the VSNet 2005 SP2.
Joined: 25-Nov-2007
Thanks for the suggestions. I set LivePersistence to True, as this is what I want to use. (I had set it to false to see if it made any difference in viewing the DataAccessAdapter. However, I see the correct Adapter and the Container type "EntityCollection". It is the Entity factory that is not listed--just an empty drop down box in the designer.)
I had made some minor changes to the database, so I refreshed the catalog in my LLBLGen Pro project, checked the fields to make sure they were mapped correctly and regenerated the code into an empty folder. I removed and then added again the new Generic and DBSpecific projects and the references in my Visual Studio 2005 project, cleaned and rebuilt everything.
Although I searched the Microsoft download site, I was not able to find a SP2 for Visual Studio 2005. I do have SP2 for the .NET20 framework already installed on my system, but perhaps Visual Studio isn't configured correctly to use this?
As another project is working, I'll continue to compare settings and see if I can figure out why my mapped tables aren't showing up. I realize this is probably a Visual Studio problem, but I appreciate any suggestions.
Sorry I meant VSNet 2005 SP1 (http://support.microsoft.com/kb/928957). Anyway if you write the LLBLGenProDataSource manual it should work, if you reference the correct assemblies (your DBGeneric, your DBSpecific, and ORMSupportClasses).
(Edit) We had seen this question a lot of times, so please read the past threads to see if any of those could help you: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=8827&StartAtMessage=0뺼 http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=11934&StartAtMessage=0𐍞
Joined: 25-Nov-2007
I checked the other postings and they do help. However I am still working on this without success.
I reinstalled SP1 for Visual Studio 2005 and also checked the version of the LLBLGenProDataSource2 in the toolbox. (I am not sure which version I should use, but I tried both versions 2.5.0.0 and 2.6.0.0.) The strange thing about the error I am getting now is that it refers to a datasource named '_tapStudentEntityDS', which I had deleted and then cleaned rebuilt the projects before trying a new data source control and using a different name for the programatic ID. Is there a "deeper" clean I should be doing, perhaps manually deleting some of the files that have been referenced? Or should I add my references by browsing to the .dll rather than using the pick list?
Thanks, and I will post any updates if I have success or find out more.
Current error message and stack trace: The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource. A control with ID '_tapStudentEntityDS' could not be found. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource. A control with ID '_tapStudentEntityDS' could not be found.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): The DataSourceID of 'GridView1' must be the ID of a control of type IDataSource. A control with ID '_tapStudentEntityDS' could not be found.] System.Web.UI.WebControls.DataBoundControl.GetDataSource() +8558374 System.Web.UI.WebControls.DataBoundControl.ConnectToDataSourceView() +37 System.Web.UI.WebControls.DataBoundControl.OnLoad(EventArgs e) +19 System.Web.UI.Control.LoadRecursive() +50 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Control.LoadRecursive() +141 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +627
Version Information: Microsoft .NET Framework Version:2.0.50727.3620; ASP.NET Version:2.0.50727.3618
If you use LLBLGen v2.6 you should reference v2.6 assemblies. Is there any chance you can pack your project (your code and a DB DDL script, without binaries) and attach it or send it to support AT llblgen Dot com? You could open a Helpdesk thread (private) to do that. That way we could investigat this.
Joined: 25-Nov-2007
This makes sense; I checked and the v2.6 version of the LLBLGenProDataSource2 is the one I have selected for the toolbox in Visual Studio 2005. I also checked my generic and DBSpecific projects and my web application in Visual Studio to make sure that the SD.LLBLGen.Pro.ORMSupportClasses.NET20 reference was the same version in all three places. And my web project references the generated code.
I will open a new thread and send my zipped files. I have the DDL for the Oracle table, and for my LLBLGen project and Visual Studio solution I have copied and zipped all the files except for the bin folders in each.
Thanks for your help.
Joined: 25-Nov-2007
In case this helps someone else, here is the solution I found after getting help through the Help Desk area and having my code tested out. There were multiple problems, but trying again through a new web project and fixing permissions on my Oracle database tables seemed to resolve the problem of the entity factories not showing up in the drop down box of the designer.
Success!
I tried both your suggestions, clearing cache that I could find and opening a new web project. In the new web project, everything showed up as expected in the designer.
However, when I began debugging I encountered an error that permissions were not granted. As it turns out, I think my problem was the same that someone else mentioned in one of the threads you referred me to, "NEVER rule out the possibility of sheer and utter stupidity.." I believe my initial problem was likely that I created two new tables as owner of the schema and generated new code. However, in the Oracle database I had neglected to have the owner account grant permissions on the tables to the user account. It is the user account that accesses the database in my web application.
After I fixed my permissions, everything works in the new web project. However, the old web project still has the weird problem in the designer. I plan to move files to a new project and proceed from there.
Thanks very much for your help. Knowing that my code worked for you helped a lot. Carol