This question is locked. New answers and comments are not allowed.
I'm creating an application using the same structure as the Northwind N-Tier Web Demo Application. In my application i have a cross reference table between a Customer table, and Customer property table. The cross reference table has a value so instead of using open access to reverse map it to a collection i mapped it using the map functionality so I can have access to the value. When I use the map functionality I get a dictionary object of <Customer, string>. I have a couple questions.
1. Am I using the map functionality correctly? I'm new to open access and I am learning as I go.
2. In the demo application it has an Assembler class that connects the business objects to the Data Access objects using the code below.
| internal static class OrderAssembler |
| { |
| internal static List<Order> AssembleContracts(IQueryable<DAL.Order> froms) |
| { |
| List<Order> tos = new List<Order>(); |
| foreach (DAL.Order from in froms) |
| { |
| tos.Add(AssembleContract(from)); |
| } |
| return tos; |
| } |
| internal static List<Order> AssembleContracts(IEnumerable<DAL.Order> froms) |
| { |
| List<Order> tos = new List<Order>(); |
| foreach (DAL.Order from in froms) |
| { |
| tos.Add(AssembleContract(from)); |
| } |
| return tos; |
| } |
| internal static Order AssembleContract(DAL.Order from) |
| { |
| Order to = new Order(); |
| to.OrderID = from.OrderID; |
| to.OrderDate = from.OrderDate; |
| to.RequiredDate = from.RequiredDate; |
| to.ShippedDate = from.ShippedDate; |
| to.Freight = from.Freight; |
| to.ShipName = from.ShipName; |
| to.ShipAddress = from.ShipAddress; |
| to.ShipCity = from.ShipCity; |
| to.ShipRegion = from.ShipRegion; |
| to.ShipPostalCode = from.ShipPostalCode; |
| to.ShipCountry = from.ShipCountry; |
| if (from.Shipper != null) |
| { |
| to.Shipper = ShipperAssembler.AssembleContract(from.Shipper); |
| } |
| if (from.Customer != null) |
| { |
| to.CustomerID = from.Customer.CustomerID; |
| } |
| if (from.Employee != null) |
| { |
| to.EmployeeID = from.Employee.EmployeeID; |
| } |
| return to; |
| } |
| } |
What would the AssembleContracts method need to look like to assemble the dictionary property?
3. Is there a better suggestion for having dynamic property values between customers and customer properties other than what I have done? Thank you.