Main Page | Report this Page
.NET DotNet Forum Index  »  Visual C# Forum  »  XML and UnitOfWork. Possible?...
Page 1 of 1    

XML and UnitOfWork. Possible?...

Author Message
shapper...
Posted: Sat Oct 31, 2009 1:56 pm
Guest
Hello,

Is it possible to create a UnitOfWork/DataContext over XML files and
use Linq?

Basically, I would like to use XML files as follows:

IUnitOfWork unitOfWork = new MyDateContext(dataPath);
CustomerRepository customerRepository = new CustomerRepository
(unitOfWork);
Customer customer = customerRepository.GetCustomerById("ALFKI");
ProductRepository productRepository = new ProductRepository
(unitOfWork);
Product product = productRepository.GetById(1);
OrderRepository orderRepository = new OrderRepository(unitOfWork);
Order order = new Order(customer);
order.AddNewOrderDetail(product, 1);
orderRepository.AddOrder(order);
unitOfWork.Save();

The variable dataPath contains the path of where all XML files that
create the context are.
I think this would be the best way to do this ...

I already use something like this with LinqToSql and SQL database.

I would just like to have something like this with XML files.

Maybe in IUnitOfWork I can create a method Save that saves all files
in the context?
And where should I load the files?
Inside the services?
Not all services need all files ...

I am just wondering how to do this.

Thanks,
Miguel
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Sun Dec 06, 2009 7:22 am