Inheritance problem

Dec 1, 2008 at 4:36 AM
Hi

I have a set of pre-created data model classes. These classes inherit from an abstract base class which provides generic functionality that is used by the application.
This base class declares a public property named "UniqueID" - All objects are required to provide this ID (usually primary key), which is then used to generate a application-wide ID. (Objects can come from multiple datasources, which could result in the same UniqueID being used)

The problem I have is that I am receiving a "Reference [UniqueID] not found" error message when trying to use UniqueID in a LINQ query (being thrown at Evaluant.Uss.SqlMapper.SqlMapperTransformer.ConvertToSQL).
I have defined UniqueID as an attribute in the mapping XML file.

I should also point out that the base class is defined in a seperate assembly and does not map to any table (I've read the inheritance strategies in the documentation but couldn't get any of them to work).

I'm not sure if this is being caused by an error in my configuration or the SqlMapperTransformer class - Any ideas would be appreciated.

Thanks
Matthew
Coordinator
Dec 2, 2008 at 12:06 PM
Do you want to use this UniqueID as a technical identifier or let Euss manage the stantard Id value ?
I will try to make a POC for you when you answer.

Regards,
Sebastien
Dec 2, 2008 at 8:54 PM
UniqueID maps to the primary key of each table (or record). It is either generated by the database or inserted by the user (for example, a Product Code).

Since my application can contain multiple databases, I have added another property named 'ID'. This is a application-wide ID generated from the database source name and the UniqueID.

I probably should rename UniqueID - this property is not always unique, so the name is a bit confusing.

Basically, each object will have:
UniqueID    Database record identifier.
ID               Application unique identifier that is automatically generated.

Not sure what is easiest for Euss - hopefully this post should help explain what I'm trying to do. As long as I can get something to work, I'm happy :)

Thanks
Matthew
Dec 4, 2008 at 6:55 AM
Hi Sebastien,

I was wondering this as well.  We have an abstract base class that provides certain services and a unique id for all of our application objects - but it doesn't need to be persistent.  In  Nhib you can do this by not mapping the base class and it will persist the base class members in the child class table if you are using table per hierarchy.   Is the same possible in EUSS? 

Cheers,

Terence


Coordinator
Dec 4, 2008 at 9:15 AM
Yes, this is the same. I'll provide both of you with an in depth example ASAP.
Coordinator
Dec 9, 2008 at 11:03 AM
I made the sample. You can download it at this url: http://dl.free.fr/t6HdD5n2t

Besides you'll have to grab the latest version on our subversion repository: http://svn.evaluant.com:8443/svn/euss. login/passwor: svnuser/svnuser

Sebastien