Control over C# Code Generation

I`m currently evaluation DBVA for our enterprise target applications.

My first impression is this product is very professional and could answer our architecture problems.

Before going too far, I looked at the generated code and noticed all classes are generated without any inheritance.

Since client/server applications in .net are mostly using .NET remoting or Web Services.

My question there is a way to control the declaration syntax of the generated classes ?

.NET remoting objects must be declared like this:
class Car : MarshalByRefObject

Web Services:
class Car : Serializable

Thanks,

Sébastien
Contek inc.
Your partner in quality control and material testing

Ok I found that only the attribute [Serializable] before the class would be correct.

I looked a the Java page and there is a checkbox for the serialization. Same thing should apply for .net.

Also:

There is no namespace in the generated Code. There is a way to specify ?

There is also no namespace and assembly name in the generated mapping file. There is a way to specify ?

Thanks,

Sébastien

Hi Sébastien,

Sorry for my late reply.

For your original post, in ORM code generation, the generated code is for persistence only. For code to be used in remote and web service. please use normal code synchronization. You may consider using the integration version of DB-VA (e.g. DBVA for Eclipse) which supports both ORM and code synchronization.

Will get back to you on the second questions as soon as possible.

Best regards,
Jick

Hi Sébastien,

The assembly name can be defined in the Database Code Generation dialog box.

The namespace is the package defined in the model. (following the model tree structure)

Hope this helps.

Best regards,
Jick

namespace.png


assemblyName.png

Hi Sébastien,

We’ll support Serializable in the coming release, which will be released in the next week.

Best regards,
Jick

Hi Jick,

Thanks for your ansers. It works as expected.

One thing to mention when generating source code:

When using the option persistent API DAO or plain .NET object, the generated code looks like:

using System;
using Orm;
using System.Collections;
using NHibernate;
using MyNamespace.MyProject.Types;

namespace MyNamespace.MyProject.Types {
///


/// ORM-Persistable Class
///

public class EMPLOYE {

}

Since this code could be used on the client side so the reference to Orm and NHibernate should not exists.

I`m agree that the DAO classes must used these references but not the data classes.

Thanks,

Sébastien

Hi Sébastien ,

VP Suite 3.1 Service Pack 1 has been released with the support of Serializable in .NET ORM code generation. If you are running VP Suite 3.1, you can advance to Service Pack 1 by running the Updater inside the bin folder of VP Suite installation directory.

As always, feel free to let me know if there are any questions.

Best regards,
Jick


serializable.png