Custom business class

Posts   
 
    
hotchill avatar
hotchill
User
Posts: 180
Joined: 22-Jan-2007
# Posted on: 22-Jan-2007 12:52:31   

Hi.

I am using version 2.0.0.0 Final, released Dec. 6th.

I am using the data adapter model. I have a distributed system. I use the llblgen SchemaImporter idiom to generate web service proxy classes.

I would like to add a custom class, not releated to any entity, to the DatabaseGeneric project. I want an Entity class to have an array of instances of this class by adding a custom (user code section) property. I would like to be able to add a section for my custom class to the generated SchemaImporter class. This would make it easy to add custom business classes.

Is it a bad idea to add custom business objects to the llblgen generated projects? If not, what is the best way to do this making use of the llblgen generated plumbing?

Thx,

Tore simple_smile

jbb avatar
jbb
User
Posts: 267
Joined: 29-Nov-2005
# Posted on: 22-Jan-2007 15:42:02   

Hello,

if you don't want your custom code to be delete on each generation, the most efficient way for me is to modify the generation template adding your custom code.

Also if your class is not generic, I think it's easier to have a separated project with your business code.

Whate do you mean by that :


I want an Entity class to have an array of instances of this class

You want to modify all your generated entityclasses? In that case, you can create a custom template.

hotchill avatar
hotchill
User
Posts: 180
Joined: 22-Jan-2007
# Posted on: 22-Jan-2007 17:43:47   

Hi.

My custom class is named ValidationError. I have an entity class called ReportInstanceEntity. I want the entity class to have the following property (in the appropriate user code section):

public ValidationError[] ValidationErrors{get;set;}

I want to:

  • add the ValidationError class to the llblgen databasegeneric project. (no, it is not deleted when regenerating the code, I think I thought I saw this on the last code generate wink )
  • include my ValidationError class in the llblgen SchemaImporter (not possible as there is no user code section).
  • make the entity class recognize the ValidationError type (it thinks the ValidationErrors property is a string now).

It would be nice to incorporate custom business classes with the llblgen generated entity business classes in an easy way.

Tore simple_smile

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 23-Jan-2007 02:23:10   

If I can't add to a class using a user code region I usually create a partial class for my custom code. Would this scenario work for you?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 23-Jan-2007 10:03:50   

The problem isn't about adding objects to the entities, that's possible through the partial classes or user code regions. The problem is with the xml serialization/deserialization. At the moment, the custom objects aren't serialized into the xml and thus aren't deserialized at the other end.

It hasn't got to do anything with the schemaimporter, as the xml serialization is done by llblgenpro code anyway, so the properties of a type arent that important, as long as a type, e.g. CustomerEntity, is known by the wsdl tool to generate stub classes (for the service class you're using to consume the webservice)

Frans Bouma | Lead developer LLBLGen Pro
hotchill avatar
hotchill
User
Posts: 180
Joined: 22-Jan-2007
# Posted on: 23-Jan-2007 10:50:23   

The problem is definitely xml serialization/deserialization as Otis states.

The reason I mention the llblgen schemaimporter is that it would be nice to be able to add sections for custom classes there. Just a suggestion for future feature simple_smile - Xml Web Service Support for custom business classes.

I am real pleased with llblgen pro though. Great product. Easy to learn. Saved my company a lot of time.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 23-Jan-2007 11:57:08   

hotchill wrote:

The problem is definitely xml serialization/deserialization as Otis states.

The reason I mention the llblgen schemaimporter is that it would be nice to be able to add sections for custom classes there. Just a suggestion for future feature simple_smile - Xml Web Service Support for custom business classes.

We've planned to add this in v2.1, so it will use the XmlSerializer object directly to serialize an instance of an object in a property of the entity.

I am real pleased with llblgen pro though. Great product. Easy to learn. Saved my company a lot of time.

Thanks! smile

Frans Bouma | Lead developer LLBLGen Pro