dimanche 1 février 2015

Improving ADO.NET impelementation

I have some thoughts about my software design. I have three entities. Order , Order Type and Order Type Items. Order can have 1-N Order Type and Order Type can have 1-N Order Type Item.


I'm working on Xamarin so using ado.net is my only option and I'm still new to ado.net. (I was using EF alot in .NET).


I've create a manager for each entity Order Manager , Order Type Manager and Order Type Item Manager. Each manager is used to provide an interface for the database. I guess they are called Data Access Classes. I use Singleton pattern in each manager.


Ok , so if I want to get the order items for a specific order I have to write something like this :



FSServiceOrder currentOrder = GetCurrentOrder();

List<FSOrderTypeItem> orderItems = FSOrderManager.Instance.GetOrderTypesItems(currentOrder.ServiceOrderID);


What should I change in the design to be able to write something like this smoothly



List<FSOrderTypeItem> orderItems = FSOrderManager.ActiveOrder.GetOrderTypesItems(currentOrder.ServiceOrderID);


And can I incorporate some caching capabilities with this ? I mean like caching the active order and the items of it and so on


Aucun commentaire:

Enregistrer un commentaire