Relative Content

Tag Archive for .netdatabaseforeign-keysdatabase-migrationnullable

How to allow null in database column with setting database code-first

I created a database in my ASP.NET Web API project, but inserting data causes a problem, because all columns by default are ColName (type, not null). I have StartDate and EndDate. With first insert I would like EndDate to be null. I didn’t find any data attributes to allow null.

How to allow null in DB column with setting DB code first

I created DB in my .NET API project, but inserting data cause a problem, because all fields by default are ColName(type, not null). I have there startDate and EndDate. With first insert I would like EndDate to be null. I didn’t find any data attributes to allow null. As well changing data manually in my ApplicationDBContextModelSnaphot to ‘has default value NULL’ doesn’t do anything neither. How optionally allow fields to be null?