Quantcast
Channel: CSLA .NET
Viewing all articles
Browse latest Browse all 764

Is it possible to use two different data sources with two different concrete DALs

$
0
0

Hi,

What would be the proper way to code if you have two different data sources?

For instance, in my project I have a SQL2008R2 Data Source with the main data, and a XML file which defines the filter conditions of what to retrieve from the main database. I.e. the XML file have the criterias defined which I use when I want to select what to retrieve from the SQL database.

As it is now I have implemented both in my concrete Dal called DalSql, but I would rather have the XML implementation in its own concrete Dal.  

In my abstract Dal I have one interface called IOrtSettings, which defines methods for retrieving data from the SQL database, and one  interface called IOrtSettingsFilter which defines which OrtSettings to retrieve. These interfaces are then implemented in the concrete Dal, DalSql. 

Below is an example of the XML-file used with filter conditions. The CategoryId and VariableId fields are columns in a table in the SQL database, and the values are used to define what should be retrieved.

These filter options (MapDto's below) can also vary from client to client, so there is a scenario where you use an admin interface to set new filter options, which are then written to the XML-file, or delete existing filter options in the XML-file.

My problem is that since the XML-file have its own edit scenario, I'm not sure the way I've made my implementation is the best way to do it. It works, but shouldn't the XML-part have it's own area, like its own concrete Dal, for instance a DalXml?


<?xml version="1.0" encoding="UTF-8"?>
<OrtSettingsFilter xmlns="http://www.ortivus.com" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <MapDto>
     <CategoryId>Ortivus</CategoryId>
     <VariableId>SW-options</VariableId>
 </MapDto>
 <MapDto>
   <CategoryId>MMM</CategoryId>
   <VariableId>MMMLocation</VariableId>
 </MapDto>
 <MapDto>
   <CategoryId>MMM</CategoryId>
   <VariableId>MMMName</VariableId>
 </MapDto>
 <MapDto>
   <CategoryId>Hardware</CategoryId>
   <VariableId>MU1</VariableId>
 </MapDto>
 <MapDto>
   <CategoryId>InstalledMSI</CategoryId>
   <VariableId>Ortivus MMM</VariableId>
 </MapDto>
 </OrtSettingsFilter>


Viewing all articles
Browse latest Browse all 764

Trending Articles