Hello Stackers :)
I have implemented the Unity DI in a project of mine, but I have, what I believe is a simple question.
My DataContext:
public partial class AuctionDataContext : DataContext {
public Table<AuctionItem> AuctionItems;
...
}
Some code for inserting an AuctionItem in the database. Please notice how I cast the interface to the actual type. This is for everything to work correct with the DataContext.
public void Insert(IAuctionItem item) {
_dataStore.DataContext.AuctionItems.InsertOnSubmit((AuctionItem)item);
_dataStore.DataContext.SubmitChanges();
}
Neither the AuctionItem nor the DataContext type is ever exposed to the client code but are only accessible inside the database layer. I guess my question is, is this an ok architecture ?