Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> Target Per Hierarchy and DeleteEntitiesDirectly
 

Pages: 1
LLBLGen Pro Runtime Framework
Target Per Hierarchy and DeleteEntitiesDirectly
Page:1/1 

  Print all messages in this thread  
Poster Message
mshe
User



Location:
Markham, Canada
Joined on:
02-Feb-2006 23:31:34
Posted:
167 posts
# Posted on: 20-Jun-2008 00:23:42.  
Hello,

I have a table called Schedules, it contains different types of schedules. The base entity (ScheduleEntity) is abstract.

If I issue a a DeleteEntitiesDirectly, I get the following exception:

Adapter.DeleteEntitiesDirectly(GetType(ScheduleEntity), New RelationPredicateBucket(ScheduleFields.CampaignID = CampaignID))

No parameterless constructor defined for this object.

at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)
at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache)
at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache)
at System.Activator.CreateInstance(Type type, Boolean nonPublic)
at System.Activator.CreateInstance(Type type)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.DeleteEntitiesDirectly(Type typeOfEntity, IRelationPredicateBucket filterBucket)
at ScheduleDataService.DeleteSchedulesByCampaignID(IDataAccessAdapter Adapter, Int32 CampaignID) in D:\MyComapny\Projects\Media Center 3.5\MyComapny.MyProduct.DAL\MyComapny.MyProduct.DAL\ScheduleDataService.vb:line 72

Is there a way to used the typed signature to delete TargetPerHierarchy entries?

It seems if I pass in the string version of my entity names it works Confused
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14531 posts
# Posted on: 20-Jun-2008 10:25:27.  
Quote:
Adapter.DeleteEntitiesDirectly(GetType(ScheduleEntity), New RelationPredicateBucket(ScheduleFields.CampaignID = CampaignID))

No parameterless constructor defined for this object.

at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck)

There is no parameterless CTor for abstract entity class.

Please use the supertype's name.

Hint: you may control which types are deleted through type filters added to your RelationPredicateBucket object you pass to DeleteEntitiesDirectly().


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37645 posts
# Posted on: 20-Jun-2008 10:45:47.  
It has to create an instance of the type to be able to do auditing etc. It performs a normal ctor construction call by using Activator.CreateInstance(), and if the type is an abstract entity, there's no public ctor so it can't instantiate an instance.

For these entities, either don't make the type abstract (if you use auditing etc.) or use the string based overload.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.