Hi!
This was helpful, although what I'm trying to do now to start with is to get CSDL, SSDL and MSL based on my existing .edmx and use those for Oracle (which works fine if I use MSL, CSDL and SSDL as embedded resources in connection string like so):
Code: Select all
... connectionString="metadata=res://*/DashboardModel.csdl|res://*/DashboardModel.ssdl|res://*/DashboardModel.msl;provider=Oracle.DataAccess.Client;
But now that I generate Oracle CSDL, SSDL and MSL using Entity Developer I haven't been able to make it work. So I'm basically trying to get this work the same way like it works with the original .edmx (as embedded) but use Entity Developer generated CSDL, SSDL and MSL instead.
Connection string is like this:
Code: Select all
... connectionString="metadata=.\DashboardModel.Oracle.csdl|.\DashboardModel.Oracle.ssdl|.\DashboardModel.Oracle.msl;provider=Oracle.DataAccess.Client;...
What I just tried:
- changed DbContext template to use "Database Independent = True", "Fluent Mapping = True", then there's this "Mapping Generation Strategy", should I go with default UseOnModelCreatingMethod?
After generating the code, should I replace the Model.Designer.cs that Visual Studio has generated for my .edmx to this .Designer.cs that is generated by Entity Developer? I did that and I had to add some assemblies to the project (EntityFramework, System.Data.Entity, System.ComponentModel.DataAnnotations,...) to get rid of some errors but there is still some left:
Error 79 Argument 1: cannot convert from 'System.Data.Objects.ObjectContext' to 'string'
Error 30 Argument 2: cannot convert from 'bool' to 'System.Data.Entity.Infrastructure.DbCompiledModel'
Error 78 The best overloaded method match for 'System.Data.Entity.DbContext.DbContext(string, System.Data.Entity.Infrastructure.DbCompiledModel)' has some invalid arguments
At this point I had added EntityFramework 6 to my project using NuGet:
install-package EntityFramework -Project <myproject>
All errors come in this part of the code:
Code: Select all
/// <summary>
/// Initialize a new EDMEntitiesEF object.
/// </summary>
public EDMEntitiesEF(ObjectContext objectContext, bool dbContextOwnsObjectContext) :
base(objectContext, dbContextOwnsObjectContext)
{
Configure();
}
So could you clarify that I do need to replace this Visual Studio generated .Designer.cs with the one that Entity Developer generates and in addition I need to set connection string to use CSDL, SSDL and MSL of the oracle model? Previously I have only tried to use these CSDL, SSDL and MSL's like in my connection string example and I get error:
The Member 'DashboardUser' in the conceptual model type 'Model.USER_PARAMETER__USER_FK' is not present in the CLR type 'Model.USER_PARAMETER__USER_FK'.
After I get this Oracle model working using these files I think it's easier to generate same files for MSSQL Server and get it working also... But when generating files for MSSQL I don't need to use that .Designer.cs because it's basically the same that I created with Oracle, right?
My library project that uses this Oracle .edmx is using .NET Framework 4 as Target framework.
What is the minimum EntityFramework version for this btw? I added EntityFramework 6 earlier to the project and now that I changed it to 4.3.1 I didn't get the errors above anymore but new ones instead:
Error 76 The type or namespace name 'Schema' does not exist in the namespace 'System.ComponentModel.DataAnnotations' (are you missing an assembly reference?)
Thanks for all the information you can provide, we need to get this multi-DB support working asap.
Br,
Kalle