I'm working on a module in orchardCMS and I am trying to save object in database but when I invoke the method create it throws exception saying "NHibernate Property Value exception" not-null property references a null or transient value LinksHandling.Models.Links_DM.ContentItemRecord
In my db table all columns are nullable but ID column is not nullable and Id Column is Identity so in my object I have values in all attributes and id is set to 0. When I go to save this object as below it donot work. However I have made such a function earlier
and it was working as well.
public bool createLink(Links_DM linkModel)
var link = _linksRepository.Table.FirstOrDefault(p => p.LinkUrl == linkModel.LinkUrl);
if (link == null)
I'm banging my head to figure the issue but could not reach to a solution yet.
here is my Migration.cs
table => table
.Column<int>("Id", column => column.PrimaryKey().Identity())
Please help me figure out The issue. Thanks, Sohaib