InsertNullBehaviour.InsertDefaultOrNull not working in build server
Posted: Tue 19 Aug 2014 09:20
We have a problem with dot connect of oracle when using EF6. In the stored file for .edml file generated we set following.
The Address_Id is populated correctly when record is saved in my local PC. However when we deploy this code using TFS build script the application do not generate correct insert sql as it do not include Address_id in the sql.
We get back database error due to this since key value cannot be inserted as null. I have installed EntityFramework dll in the project from Nuget package which I restored in the solution for TFS build. Everything else works fine for EF6 just the storedgeneratedpattern does not work. Am I missing anything? Here is the generated SQL
Looking at the assemblies generated by TFS build (using .net reflector) I can see .csdl, .msl and .ssdl resources being correctly embedded. What is build server missing for EF6?
Code: Select all
<Property Name="ADDRESS_ID" Type="int64" Nullable="false" devart:DefaultValue="DDD_ADDRESS_ID.NEXTVAL" StoreGeneratedPattern="Identity" />We get back database error due to this since key value cannot be inserted as null. I have installed EntityFramework dll in the project from Nuget package which I restored in the solution for TFS build. Everything else works fine for EF6 just the storedgeneratedpattern does not work. Am I missing anything? Here is the generated SQL
Code: Select all
DECLARE
updatedRowid ROWID;
BEGIN
INSERT INTO AGTAPP.DDD_CONTACT(ROLE, FIRST_NAME, LAST_NAME, PHONE, MOBILE, FAX, EMAIL, QC_REPORT_CONTACT, LAST_UPDATED_BY)
VALUES (NULL, :p0, :p1, NULL, :p2, NULL, NULL, NULL, :p3)
RETURNING ROWID INTO updatedRowid;
OPEN :outParameter FOR SELECT DDD_CONTACT_ID, LAST_UPDATED_DATE FROM AGTAPP.DDD_CONTACT WHERE ROWID = updatedRowid;
END;
Code: Select all
// Here we configure the EF-provider, so that the default values defined in the model are used
var config = OracleEntityProviderConfig.Instance;
config.DmlOptions.InsertNullBehaviour = InsertNullBehaviour.InsertDefaultOrNull;
_context = new DDDEntities();