help
Root Question Message
new Material(_viewmodel.Name, _viewmodel.MaterialType.Id)
SQL error 19 Unique Id failed
new Material(_viewmodel.Name, _viewmodel.MaterialType)
context.Add()
and then create the material, referencing the material type you just added. EntityFramework will fill in the Id for you.context.Add()
will fix your issue because it will start tracking it.context.Attach(theThing)