You are right, marcind. This post should be moved. Can someone move it for me?
Anyway, the closest I have some is using a raw set of model classes, and in your linq to sql entities, you have to do something like this:
private List<NorthwindTest.Model.Product> GetAllProductsFromTheDatabase()
{
Monkey.Northwind northwind = new Monkey.Northwind("connection string"); // note that Monkey.Northwind is where the northwind connection stuff is, but NorthwindTest.Model is where the entities are.
List<NorthwindTest.Model.Product> products = (from p in northwind.Products
select new NorthwindTest.Model.Product()
{
CategoryID = p.CategoryID,
Discontinued = p.Discontinued,
ProductID = p.ProductID,
ProductName = p.ProductName,
QuantityPerUnit = p.QuantityPerUnit,
ReorderLevel = p.ReorderLevel,
SupplierID = p.SupplierID,
UnitPrice = p.UnitPrice,
UnitsInStock = p.UnitsInStock,
UnitsOnOrder = p.UnitsOnOrder
}).ToList();
return products;
}
Then, you do the same over in xml land, and it should work. You still have a dto type situation with the same model defined in Monkey.Northwind as in NorthwindTest.Data, but there is no way to get around it, from what I can tell. So, you can have a clean model with providers for both xml and sql server using linq as your data access, without violating DRY too much.
Inserts and updates, like with all of linq, are another story and Ill check those out next.
Jesse Foster | jf26028