开发者

How can i get linq to sql to map my type when i use a parameterized constructor?

开发者 https://www.devze.com 2023-02-23 03:48 出处:网络
I know that L2S is not designed to map custom/POCO types to L2S-entity types without the object initializer syntax. But is there a back-book way to achieve this so that i can project into开发者_高级运

I know that L2S is not designed to map custom/POCO types to L2S-entity types without the object initializer syntax. But is there a back-book way to achieve this so that i can project into开发者_高级运维 my POCO with a parameterized constructor and not get stung when i try to apply an expression to that result?


Do a ToList() into memory and run your statements against in-memory collection.

Yes of course its not as effecient as querying against L2S IQueryable. But the design is cleaner.

I been down that road before. It turned out badly. L2S and EF implementation of IQueryable just does not work (well) with anything other than the object it was designed for.


You can't.

And if there is a "back-book way" I haven't found it (and I suspect I don't want to).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号