View Generation for Fluent Mapping/Code First

Discussion of open issues, suggestions and bugs regarding Entity Framework support in ADO.NET Data providers
Post Reply
esben
Posts: 43
Joined: Tue 05 Jul 2011 09:40

View Generation for Fluent Mapping/Code First

Post by esben » Mon 01 Oct 2012 14:41

Is there any way that the entity framework view generation can be done for code first/fluent mapping models?

I tried experimenting by having the view generated by the template in Entity Developer even though we use database independent fluent mapping (modified the conditional on the template). The result is a nice view, which EF doesn't like because of the hashing values.

I also tried template solutions and the EF Power Tools, both of these solutions suffer from a need to have a database to connect to and the resulting generated view is "database dependant" even though no code is actually different (i tried on an MSSQL and an Oracle database, the only differing values were the hashes).

If there isnt any way (hacky or otherwise) to do this today, is it even possible to implement it in a future version of Entity Developer or is it a design error from MS?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: View Generation for Fluent Mapping/Code First

Post by Shalex » Fri 05 Oct 2012 09:58

esben wrote:I tried experimenting by having the view generated by the template in Entity Developer even though we use database independent fluent mapping (modified the conditional on the template).
Currently, pregenerating view is not created (and not supported) when the DbContext template is used and its Fluent Mapping property is set to True. We think that pregenerating view was generated in your case because Fluent Mapping was set to False. The pregenerating view support with Fluent Mapping=true is on our road map.
esben wrote:the resulting generated view is "database dependant" even though no code is actually different (i tried on an MSSQL and an Oracle database, the only differing values were the hashes)
Hashes are generated by Microsoft code so we cannot give you information how it is created. It is possible that the same view cannot be used with different databases.

esben
Posts: 43
Joined: Tue 05 Jul 2011 09:40

Re: View Generation for Fluent Mapping/Code First

Post by esben » Fri 05 Oct 2012 10:02

Shalex wrote: Currently, pregenerating view is not created (and not supported) when the DbContext template is used and its Fluent Mapping property is set to True. We think that pregenerating view was generated in your case because Fluent Mapping was set to False. The pregenerating view support with Fluent Mapping=true is on our road map.
Nope the view was generated because i modified the template to do it, but that is irrelevant (was just for general information)
Shalex wrote: Hashes are generated by Microsoft code so we cannot give you information how it is created. It is possible that the same view cannot be used with different databases.
Fair enough, not much to do about it I guess. Would be nice to know if you somehow get more information on this.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: View Generation for Fluent Mapping/Code First

Post by Shalex » Tue 09 Oct 2012 13:41

We recommend you to refer this question to Microsoft:
http://connect.microsoft.com/
http://social.msdn.microsoft.com/

Post Reply