Author |
Share Topic Topic Search Topic Options
|
-ook
Groupie
Joined: 26-Aug-2007
Location: Australia
Posts: 41
|
Post Options
Quote Reply
Topic: Multiple Datasources Posted: 15-Apr-2014 at 11:16pm |
Found the solution - as I should have guessed not an Ideablade issue. Seems one has to add a raft of Entityframework options to the configuration file.
|
|
-ook
Groupie
Joined: 26-Aug-2007
Location: Australia
Posts: 41
|
Post Options
Quote Reply
Posted: 15-Apr-2014 at 10:20pm |
I should also not this is an n-tier deployment, so the web server is providing the error.
If I set 'metadata Artifact processing' to 'Copy to Output Directory' then the cdsl and other files are correctly produced. I have even copied these over to the web server and still it does not pick them up.
Very annoying, one of the reasons I bought IdeaBlade was that it was easy to configure- seems deployment is another issue. I cannot afford to spend days trying to sort this out - totally non productive use of my time.
|
|
-ook
Groupie
Joined: 26-Aug-2007
Location: Australia
Posts: 41
|
Post Options
Quote Reply
Posted: 15-Apr-2014 at 9:24pm |
Right....well it does not work unfortunately.
{"Key 'ForecastEntities': The model's metadata artifact files (csdl, msl, ssdl) are either invalid or could not be found, either as resources in an assembly or loose in the output directory. Perhaps you have multiple assemblies containing the same metadata. Check the connection string for key 'ForecastEntities', which says the artifact filenames are Forecast.csdl, Forecast.ssdl, and Forecast.msl. Do these names match the actual artifact filenames? All three root names (e.g., 'Forecast') should be the same and match the edmx filename unless you changed them deliberately."}
In the edmx designer I have changed EntityManagerName to 'MyEntities' and left the rest as ForecastEntities (DatasourceKey and EntityContainerName).
Any ideas?
|
|
DenisK
IdeaBlade
Joined: 25-Aug-2010
Posts: 715
|
Post Options
Quote Reply
Posted: 14-Apr-2014 at 1:25pm |
You can't set a DataSourceKeyName on your POCO entities. DevForce will differentiate between your POCO and DevForce entities by the fact that your DevForce entities inherit from Ideablade.EntityModel.Entity class, and your POCO entities don't.
Furthermore, since you already implemented your custom POCO service provider, DevForce will try to match your POCO queries by convention.
The DataSourceKeyName is needed on DevForce entities in order for DevForce to discover the named connection string in your config file.
|
|
-ook
Groupie
Joined: 26-Aug-2007
Location: Australia
Posts: 41
|
Post Options
Quote Reply
Posted: 14-Apr-2014 at 12:03am |
I think I might have confused you there. Yes I shall maintain two models, the DataSourceKeyName for the SQL datasource is set in the designer and that takes care of that. However for the POCO entities I now need to set a DataSourceKeyName for those in order to differentiate them from the SQL entities. So my question is whether I can set the DataSourceKeyName on the POCO base class and thus not have to go through each POCO entity and copy paste it.
|
|
DenisK
IdeaBlade
Joined: 25-Aug-2010
Posts: 715
|
Post Options
Quote Reply
Posted: 11-Apr-2014 at 12:04pm |
That won't work. You're essentially telling DevForce to treat this entity as both POCO and DevForce first class citizen and it'll get confused.
I may be missing something on your use case here. Since you're dealing with 2 unrelated data sources, one non-Sql and one Sql, you should be able to maintain 2 different models, one POCO, which you already have, and one DevForce, which you can generate with the help of DevForce code generation tools.
Maybe I've misunderstood?
|
|
-ook
Groupie
Joined: 26-Aug-2007
Location: Australia
Posts: 41
|
Post Options
Quote Reply
Posted: 10-Apr-2014 at 6:42pm |
Ok... my poco entities have a base class 'public abstract class BaseClass : IKnownType, IHasPocoEntityAspect, INotifyPropertyChanged'
If I put the attribute [IbEm.DataSourceKeyName(@"HistorianPOCOEntities")] on that I will not need to go through and assign it to each individual derived poco entity?
|
|
DenisK
IdeaBlade
Joined: 25-Aug-2010
Posts: 715
|
Post Options
Quote Reply
Posted: 09-Apr-2014 at 4:00pm |
When you have a Sql Server backed database, all code generation are handled by DevForce EDM Designer Extension Tools. In other words, the steps that you had to do for your POCO manager are handled automatically by this tool.
Yes, you will need to add a new "ADO.NET Entity Data Model", and you can specify in the designer to generate the entities to you existing MyEntityManager.
The following tutorial should help get you started.
http://drc.ideablade.com/devforce-2012/bin/view/Documentation/model-create
|
|
-ook
Groupie
Joined: 26-Aug-2007
Location: Australia
Posts: 41
|
Post Options
Quote Reply
Posted: 09-Apr-2014 at 3:43pm |
Hi Denis
I did read that, but I must be missing some details. Here is were I am confused. I have followed the POCO guide to obtain data from a Historian (this uses a custom API hence the need for custom POCO classes and providers). I followed (http://drc.ideablade.com/devforce-2012/bin/view/Documentation/poco-service-provider-class) in order to create the 'Provider' (lets call it MyProvider) and associated EntityManager (lets call it MyEntityManager).
So now I have MyProivider that contains very specific methods to get data out of the Historian via its API. Within my client application I am using MyEntityManager to gain access to those entities.
Now I want to access data from a SQL Server, in my client application I do not want to have another EntityManager, I want to stick with MyEntityManager and have it sort out where the datasource is. At this point nothing has been auto generated - I have had to type in every line myself.
So... I don't know what my first step is now. Do I mark all the existing classes with 'IbEm.DataSourceKeyName(@"Historian")]' first and see whether everything still works before attempting to add the SQL connection?
After that then what? If I create a new 'ADO.NET Entity Data Model' will it add everything to the existing MyEntityManager and MyProvider? Is it as simple as that?
Perhaps I should just give it a go and see what happens, but I thought it best to check first.
Thanks
|
|
DenisK
IdeaBlade
Joined: 25-Aug-2010
Posts: 715
|
Post Options
Quote Reply
Posted: 09-Apr-2014 at 3:22pm |
Hi Mark,
As long as you can generate DevForce entities from that second Sql server, you can use any EntityManager, generic or sub-typed, to query your entities.
The generated sub-typed EntityManager only adds syntactic sugar for querying convenience. You can always use generic EntityManager to query as follows:
var em = new EntityManager(); var query = em.GetQuery<YourEntity>();
See http://drc.ideablade.com/devforce-2012/bin/view/Documentation/many-models-per-manager for more details.
|
|
-ook
Groupie
Joined: 26-Aug-2007
Location: Australia
Posts: 41
|
Post Options
Quote Reply
Posted: 08-Apr-2014 at 9:46pm |
Hi
I have a custom POCO EntityManager and associated provider for accessing a third party non-sql datasource. This works well, now I wish to add to this EntityManager the ability to access tables from an unrelated SQL Server database (hence a totally different datasource that now can use normal ORM tools)... how do I go about doing this? Are there any articles? Do I have to create a new EntityManager and use both through my application now?
Thanks
Mark
|
|