TrackableEntities / EntityFrameworkCore.Scaffolding.Handlebars

Scaffold EF Core models using Handlebars templates.
MIT License
208 stars 53 forks source link

ValueGeneatedOnAdd for Keys #100

Closed canuszczyk closed 4 years ago

canuszczyk commented 4 years ago

It is possible that I'm misunderstanding this, but I believe that sql server identity columns, even when they are keys, should be marked as ValueGeneratedOnAdd().

tonysneed commented 4 years ago

For the fluent API, this tooling simply mimics the EF Core CLI behavior. Does the output for dotnet ef dbcontext scaffold without Handlebars scaffolding mark identity columns with ValueGeneratedOnAdd()?

tonysneed commented 4 years ago

@canuszczyk Can you clarify?

canuszczyk commented 4 years ago

Hey Tony - thanks for responding. I've been moved to so many projects in the last 3 months that I cannot remember what I was working on when the problem cropped up. I believe the issue I was having was that when I inserted a row that it was complaining that I needed to supply a value for an identity column and the .ValueGeneratedOnAdd() wasn't being placed in the modelsnapshot. I think. However, I'm looking at one I just created a few moments ago and it's there.

Sorry - next time I'll put more info in my question along with examples so that even I can remember it. Dang getting old. lol

Anyway - love this tool. BTW. Does exactly what I wanted which is to create the context and associated model files with the proper styling I like.

tonysneed commented 4 years ago

@canuszczyk Glad it works now. Happy you are enjoying the tool!