Custom Entity - Validation

Posts   
 
    
omborddata
User
Posts: 42
Joined: 18-Apr-2012
# Posted on: 26-Nov-2012 15:23:29   

Hi!

I have an entity X, which I validate with a dependency injected validator. The entity X is mapped to a table in my database. In this entity I have a xml-field. This xml-field is serialized, deserialized to my custom entity Y.

The class structure could be the following:

class X
  Id as integer
  Data as string
  MiscStuff as double
  MyXmlField as string
end class

My custom entity Y which I serialize to the MyXMLField could be:

class Y
  Id as integer 
  Type as string
  OtherData as string
end class

So to my problem, I want to validate the Y entity as well as the X entity. So how do I make my Y entity look like a llblgen database-mapped entity which can take advantage of for example the validation functionality in llblgen?

I know that I should call this in the constructor:

DependencyInjectionInfoProviderSingleton.PerformDependencyInjection(Me)

Is there a class I can inherit? If I inherit CommonEntityBase there are alot of methods I have to override. The optimal thing would be to create a CustomEntityBase class which I can inherit in my custom entities.

/Christian

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 27-Nov-2012 04:44:38   

To understand better: you de/serialize some object and save it to an xml field in your entity. But that object is not an entity, right? If that is true, then you can't make it appears like an entity. Behaving like an entity is something complex, and involves persistance info (which entity field is mapped on what DB column, etc).

David Elizondo | LLBLGen Support Team
omborddata
User
Posts: 42
Joined: 18-Apr-2012
# Posted on: 27-Nov-2012 08:59:01   

Yes, the object I de/serialize is not an entity. But the one containing the serialized xml is an entity.

Ok, and I can't make use of llblgens validator for that object in some way?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 28-Nov-2012 03:39:09   

omborddata wrote:

Ok, and I can't make use of llblgens validator for that object in some way?

AFAIK, I don't see anything you can do to make that possible. LLBLGen Validators validate IEntityCore/IEntityFieldCore objects, and to do that you should implement all those interfaces that were created thinking in entities.

David Elizondo | LLBLGen Support Team