Hi,
I’m trying linqConnect for my next product. It’s a wonderful as far as I can see. Especially in combination with dbMonitor.
Still (as of now) I’m missing something in department of flexibility. My current issue is “expendables” entities. Something like ExpendoObjects. My situation is – customer has sometimes 2 tables.First is core with fixed and known set of fields. No problem to make them into “core” entity. Take as example table “goods”. Then some customers become customer only required extensions : table “goods_ext”. They bound by “OneToOne” association. How I can provide extensions in main entity? At the end I want all filed’s from goods_ext in dictionary or in ExpendoObject-like form. All program modules that work with core functionality shouldn’t be aware of extensions. But customer-tailored modules (BL) should. I have strange feeling that I just can’t find this.
And before I start programming Factory for types and creating entities for every customer extension (don’t know if this will be solution without drawbacks) – I want ask here for hint.
Thank you in advance and thumbs up for great product!
WbR,
Andrew Zozulya
ExpendoObject like entities
Re: ExpendoObject like entities
Try implementing an inheritance instead of the “OneToOne” association. Download http://www.devart.com/entitydeveloper/e ... eloper.chm, right click the CHM file, select Properties, and click on the "Unblock" button, choose "Apply" to show the content. Open it and navigate to ORM Support > LinqConnect > Concepts > Inheritances.lapilesos wrote:First is core with fixed and known set of fields. No problem to make them into “core” entity. Take as example table “goods”. Then some customers become customer only required extensions : table “goods_ext”. They bound by “OneToOne” association. How I can provide extensions in main entity?
Re: ExpendoObject like entities
Hi,
I’ve delved a bit in inheritance documentation – but I don’t see how it could help.
Basically I need (depending on customer tables and their extensions) to map fields and create and use proper entities on the fly. But it’s versus whole concept. I’ve called my question “ExtendoObject Like” for purpose. Don’t know if such mixed breed is possible but then I saw may posts about such things in EF.
All program modules that work with „goods“ should work with „goos+goodsext“ instance as if this where old „goods“. But some business logic further down flow chain could identify this instance as “goodsext” and work with additional fields. In usual ADO.NET logic i’ll just look at fields coming from select and see additional properties. They could be there from inner join or from view. But how to map them on the fly? Or how to create dynamic object with mappings of additonal fields.
Logically „goodsext“ should be inherited from „goods“. But it will sit in different datacontext, and different assembly. It is not possible to inherit entities from other assembly and model. Andi t is not possible to work with them with EntityDeveloper.
Maybe the best way will be some basic class for datacontext that is aware of such extension possibility and that on the fly creates “goodsext” as substitute for “goods”. But still “goodsext” have to inherit from “goods” and is not possible in proposed inheritance form… I’m a bit lost on it. Linq2SQL is amazing in comparison with conventional ADO.NET but I can’t solve this extensibility problem .
WbR,
Andrew
I’ve delved a bit in inheritance documentation – but I don’t see how it could help.
Basically I need (depending on customer tables and their extensions) to map fields and create and use proper entities on the fly. But it’s versus whole concept. I’ve called my question “ExtendoObject Like” for purpose. Don’t know if such mixed breed is possible but then I saw may posts about such things in EF.
All program modules that work with „goods“ should work with „goos+goodsext“ instance as if this where old „goods“. But some business logic further down flow chain could identify this instance as “goodsext” and work with additional fields. In usual ADO.NET logic i’ll just look at fields coming from select and see additional properties. They could be there from inner join or from view. But how to map them on the fly? Or how to create dynamic object with mappings of additonal fields.
Logically „goodsext“ should be inherited from „goods“. But it will sit in different datacontext, and different assembly. It is not possible to inherit entities from other assembly and model. Andi t is not possible to work with them with EntityDeveloper.
Maybe the best way will be some basic class for datacontext that is aware of such extension possibility and that on the fly creates “goodsext” as substitute for “goods”. But still “goodsext” have to inherit from “goods” and is not possible in proposed inheritance form… I’m a bit lost on it. Linq2SQL is amazing in comparison with conventional ADO.NET but I can’t solve this extensibility problem .
WbR,
Andrew
Re: ExpendoObject like entities
Unfortunately, LinqConnect doesn't allow to implement your concept.