Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to do multiple data sources?
Message
De
20/04/2010 09:41:11
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
20/04/2010 08:02:54
Guy Pardoe
Pardoe Development Corporation
Peterborough, New Hampshire, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01460976
Message ID:
01461083
Vues:
35
Hi Guy,

This is why you would create different projects. For instance:
MyCompany.MyProject.Business.MainStuff
MyCompany.MyProject.Business.Lookups (or Utility)

Because they both connect and work with different data and use a different connection it is best to keep them seperate. I suppose there is nothing wrong with putting them in the same project however that would limit your ability to use one of them on something without the other.

I am working on a project where the primary application data is in SQL Server and is the main business project
Company.Project.Business.
Then there is some propriatery data that isn't updated used for looking up special codes. This data is kept in a VistaDB database and secured so that project is different
Company.Project.Business.Utility

We include both in the application and both have different business objects.
Tim

>Tim,
>
>A different business object ~project~ for each data source... that's a paradigm I wasn't seeing. I understand your comments about naming objects. And also the differences if both data sources are identical. In my case, these are very different objects, with very different data structures on the backend.
>
>Thanks,
>Guy
>
>
>
>
>
>>Hi Guy,
>>
>>There are a couple of different approaches depending on the data and purpose. If the data in the different data sources is not the same data, then yes, just create another Business Object Project for connecting to a second data source/ type. Set the connection in the app.config just like in your other project for that specific data. This connection is used for the development purpose. You also need to have the database key name set in your ABusinessObject. Basically everything is identical to creating your first business object project.
>>
>>Now in your web or windows application, add the new business object project. You should now have two of them. You will need to have another connection defined in your web.config or app.config of the application project so that you would have two of them; one for each business project. Also add the refrences to both business projects in your application references.
>>
>>Keep in mind you will need to be careful with names to make it easier on you. For instance don't have a business object named Orders in one business project and a business object named orders in the other as well if you can avoid it. If you must do that, you can do this no problem, but you will have to deal with it specifically.
>>
>>In a form where you are going to get data from both business object projects you just add a using statement for both projects and register them just like any other time.
>>
>>If the data is identical in each data source than you are better off not creating two busines object projects. The sample application ships with MM has both sql data and fox data but only one business project and set of entities. In that case you can switch between the data types using datasets defined like the sample or you can do it manually.
>>
>>I hope that helps
>>Tim
Timothy Bryan
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform