EF: cannot insert NULL into column

I have the following table in the database:

enter image description here

The database already has applications in the table Apps. I present them to the end user, and he must add elements to the tableAppsToDomains

I am trying to save an object in this table:

private static void FillDomains(string[] domainsWls, EntityCollection<AppToDomains_V1> AppsToDomains, 
    Guid appGuid, Guid groupId ,bool isWhiteListed)
{
    foreach (var domain in domainsWls)
    {
        AppsToDomains.Add(new AppToDomains_V1()
                              {
                                  Domain = domain,
                                  IsWhiteListed = isWhiteListed,
                                  AppId = appGuid,
                                  GroupId = groupId,
                              });
    }
}

but get the following error:

{"Cannot insert a NULL value in the" ClientAppID "column, table" MamDB.dbo.Apps "; the column does not allow zeros. INSERT does not work. \ R \ nApplication is complete." }

How can it be? since I am not adding a row to the application table

+5
source share
3 answers

, null. , , , . . , , .

, ClientAppID

0

, , null , EF . EF, .

0

One of the parameters you pass may be NULL.

 EntityCollection<AppToDomains_V1> AppsToDomains, 
    Guid appGuid, Guid groupId

You need to examine these objects and see what is connected with the table Appsand examine the zero values.

0
source

All Articles