4 Replies - 1536 Views - Last Post: 27 December 2016 - 08:23 PM

#1 Coding in the name of  Icon User is offline

  • D.I.C Regular

Reputation: 67
  • View blog
  • Posts: 291
  • Joined: 07-July 10

EF Model First, Identity 2.0

Posted 16 December 2016 - 08:40 AM

Normally I use code first to set up my databases but for sufficiently complex designs this can get difficult to read. I'm interested in using the visual model designer that is in Visual Studio but I don't know how I can set it up to include tables for Identity 2.0 and have it play nice with the rest of the auto-generated code that you normally get given (I think the user class needs to derive from EntityFramework.IdentityUser for example) and I don't know if I can set up the data annotations I'll need in the model designer.

I'd appreciate any advice on this. Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: EF Model First, Identity 2.0

#2 andrewsw  Icon User is offline

  • the case is sol-ved
  • member icon

Reputation: 6376
  • View blog
  • Posts: 25,763
  • Joined: 12-December 12

Re: EF Model First, Identity 2.0

Posted 16 December 2016 - 12:37 PM

I don't know a lot about this but this looks relevant:

Customizing the ASP.NET Identity Data Model with the Entity Framework Fluent API – Part 1

The author is making significant changes to the data model but incorporating Identity 2.0 with it.

(I also noticed on glancing around, a blog video apparently indicating that Model First would no longer be supported from EF7. I didn't investigate any further though but thought it worth mentioning.)

Here's some reading stuff:

Entity Framework goes 'code first' as Microsoft pulls visual design tool

Quote

In a recent blog post Microsoft Program Manager Rowan Miller confirms that from EF 7, code first will be the only way to use EF. Miller adds that “code first” is a misnomer, since you can reverse engineer an existing database to make it a database-first solution.

Was This Post Helpful? 1
  • +
  • -

#3 Coding in the name of  Icon User is offline

  • D.I.C Regular

Reputation: 67
  • View blog
  • Posts: 291
  • Joined: 07-July 10

Re: EF Model First, Identity 2.0

Posted 17 December 2016 - 04:18 PM

Thanks. That blog post convinced me to stay with code first.
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is offline

  • the case is sol-ved
  • member icon

Reputation: 6376
  • View blog
  • Posts: 25,763
  • Joined: 12-December 12

Re: EF Model First, Identity 2.0

Posted 17 December 2016 - 05:10 PM

Fair enough. (You obviously considered whether exploring Model First would be time well spent - offering a different perspective on EF? ;) )
Was This Post Helpful? 0
  • +
  • -

#5 wtp  Icon User is offline

  • D.I.C Regular

Reputation: 26
  • View blog
  • Posts: 319
  • Joined: 08-December 11

Re: EF Model First, Identity 2.0

Posted 27 December 2016 - 08:23 PM

I don't know why anyone would use code first or model first. SQL Server is much better equipped to build dbs then visual studio is. Database first is the best way.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1