views:

21

answers:

1

Hi,

I have a ASP.NET web application that use the same DataContextType to access several Databases with the same schema.

A problem I have is that I'd like to reference the origin Database of entities by adding to them a property (e.g. a ConnectionString property) and auto assign it on entity creation.

I though it could be done easily since i use PLINQO I already have a LinqEntityBase class but unfortunately there's no partial methods like OnMyEntityLoaded(MyEntity instance) in the DataContext class...

The only method I see to do it is in the OnLoaded method of the entity but I would have to keep a ref to the current datacontext (or the connectionString) "somewhere" before and retrieve it after, it doesn't look ok at all (and if I work with multiple dbs in the same time it is just not possible).

Someone got an idea on how i could achieve this?

+1  A: 

PLINQO is open source. If you need a partial method you could just add it to the CodeSmith template.

Also, you could submit a feature request for this on their forums or the GoogleCode issue tracker.
http://code.google.com/p/codesmith/issues/list

tdupont
The code I need is not in the Generated Files, it's inside the MS dlls,I think I would have to write my own DataContext from scratch to get what i want...
Guillaume86