Having an issue with the Db again, right we have completed all nessercary feilds and mirrored our extisting database for the purposes of replication through 2 systems.
I had to recreate fields that completely mirrored the ones we have and I can't make any changes to this... I need to in the code. I have began updating the existing entity. By adding all nesercary fields into the core, data etc.
On launching the application and viewing a product I'm hit with this error,
The 'CCCPack' property on 'Product' could not be set to a 'null' value. You must set this property to a non-null value of type 'Int32'.
In Visual Studio - NopObjectContext in bold is debugging error
Constraint Exception
//database call
var reader = cmd.ExecuteReader();
//return reader.DataReaderToObjectList<TEntity>();
var result = context.Translate<TEntity>(reader).ToList();
for (int i = 0; i < result.Count; i++)
result[i] = AttachEntityToContext(result[i]);
//close up the reader, we're done saving results
reader.Close();
return result;
I read else where on the forum to add a constraint in the db to allow to make a default of 1 etc but we can't do this I need to work it in the code due to the mirror on our existing db etc.
I have added the following in the entity but Im still hit with the same error is there a way I can turn of the constraints or relax them when uploading through the dataset????
NopCore/Domain/Product.cs
public virtual Int32 CCCPack { get; set; }
NopData/Mapping/ProductMap.cs
this.Property(p => p.CCCPack).IsOptional();
NopWeb/Models/Catalog/Product.cs
public Int32 CCCPack { get; set; }
NopWeb/Controller/CatalogController
model.CCCPack = product.CCCPack;
All help would be highly regarded.
Richard.