LLBLGen Pro version 2.6 + buildnr (latest - downloaded today - 2009-01-19)
Runtime Library File Version: 2.6.8.1211
Adapter Template - VS 2008 Professional
MS Access DB 2007
All,
Thank you in advance for your help.
We are having an issue when creating new leaf entities with the adapter template. We are using TargetPerEntity for inheritance.
Our database schema involves abstract base classes, many times consisting of nothing but an Id field, and concrete classes that are derived from those classes.
When we try to add a concrete entity, we get an error:
SD.LLBLGen.Pro.ORMSupportClasses.ORMQueryConstructionException was unhandled
Message="The insert query doesn't contain any fields."
RuntimeBuild="12112008"
RuntimeVersion="2.6.0.0"
Source="SD.LLBLGen.Pro.DQE.Access.NET20"
StackTrace:
at SD.LLBLGen.Pro.DQE.Access.DynamicQueryEngine.CreateSingleTargetInsertDQ(IEntityFieldCore[] fields, IFieldPersistenceInfo[] fieldsPersistenceInfo, IDbConnection connectionToUse, Dictionary2& fieldToParameter) at SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.CreateInsertDQ(IEntityFieldCore[] fields, IFieldPersistenceInfo[] fieldsPersistenceInfo, IDbConnection connectionToUse) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.CreateInsertDQ(IEntity2 entityToSave, IFieldPersistenceInfo[] persistenceInfoObjects) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.CreateQueryForEntityToSave(Boolean insertActions, EntityBase2 entityToSave, IPredicateExpression updateRestriction, InheritanceHierarchyType typeOfHierarchy, IFieldPersistenceInfo[] persistenceInfoObjects) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.PersistQueue(List
1 queueToPersist, Boolean insertActions, Int32& totalAmountSaved) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.SaveEntity(IEntity2 entityToSave, Boolean refetchAfterSave, IPredicateExpression updateRestriction, Boolean recurse) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.SaveEntity(IEntity2 entityToSave, Boolean refetchAfterSave) at kds.assetComplianceSuite.testApp.Form1.Form1_Load(Object sender, EventArgs e) in C:\Documents and Settings\lp\My Documents\LLBLGen Pro Projects\kds.assetComplianceSuite\kds.assetComplianceSuite.testApp\Form1.vb:line 15 at System.EventHandler.Invoke(Object sender, EventArgs e) at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Form.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmShowWindow(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow) at System.Windows.Forms.Control.SetVisibleCore(Boolean value) at System.Windows.Forms.Form.SetVisibleCore(Boolean value) at System.Windows.Forms.Control.set_Visible(Boolean value) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at kds.assetComplianceSuite.testApp.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
InnerException:
We have already figured out that, as a workaround, we can add an unused field to the abstract base class and set it to null when creating the new instance of the concrete class.
However, since it's common, in our schema, to have a base class without any fields itself, do we always have to have these unused fields to avoid this error?
Thank you.