I had an application where I wanted to have a sequence key that spanned multiple tables. Mainly to provide better logging support, so the log search would be “Find Object X” instead of “Find object X with type Y”. Then add in namespacing and the logs start to get wide, IE “Find Object 12 with type Company.Product.Service.Model.ModelName” repeated hundreds of times.
Step 1, make sure your object in Entity Framework is set to a StoreGeneratedPattern of “None”. (Right click table, select properties, go to the property window)
Change your Entities partial class to include this override to save changes.
[gist id=”400bb4513848ef85bf3a” synhi=true lang=”csharp”]