Seeing as though I've now solved all of my LINQ problems I'm not working on developing an actual model. The thing is with this is that I do not want to be tied in to a single technology, I want to have freedom to implement different data access technologies and work to a single interface.
Now, I've never done this before, but based on my OOP knowledge and experience I was coming up with an idea like the following:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Linq;
namespace Intranet.Data.Accounts
{
interface IContractsControl
{
ContractsControlViewData GetContracts(System.Nullable<int> contractTypeID,
System.Nullable<int> responsibilityID,
string expenseType,
System.Nullable<int> supplierID,
string businessID);
ContractsControlViewData GetContract(int contractID);
}
}
I've got a few questions on how this should work.
- Where should the interface live, taking into account I'm using an areas lib developed by Phil Haack. For now I've created a folder called "Data" at the root level (as you can see from the namespace).
- Our stored procedures have spurious names because they're pooled into a database, if I'm using objects I can instead work towards an object-based solution for access to sprocs. Do the names in my data access library have to reflect that of the stored procedure in this instance?
- Using a library such as this would allow me to do
Accounts.GetContracts()
in my controller. Is this wise? - Are there any design recommendations for this approach? i.e. naming schemes.
- Where should the actual implementation live? In the same folder as the interface?
The idea is that if we ever ditch LINQ then we can instead use a different data access technology (entity framework, plain ol' SQL etc.). I'd love to hear comments/criticisms/appraisals from those more experienced.