Hi All,
I am not sure whether it is possible to achieve this kind of implementation in Dot Net. Below are the information
Currently we are on an application which is done in COM+, ASP, XSL, XML technologies. It is a multi tier architecture application in which COM+ acts as the BAL. The execution steps for any CRUD operation will be defined using a seperate UI which uses XML to store the information. BAL reads the XML and understands the execution steps which are defined and executes corresponding methods in DLL. Much like EDM we have our custom model (using XML) which determines which property of object is searchable, retrievable etc. Based on this information BAL constructs queries and calls procedures to get the data.
In the current application both BAL and DAL are heavily customizable without doing any code change. the results will be transmitted to presentation layer in XML format which constructs the UI based on the data recieved.
Now I am creating a migration project which deals with employee information. It is also going to follow the N Tier architecture in which the presentation layer communicates with BAL which connects to DAL to return the Data.
Here is the problem, In our existing version we are handling every information as XML in its native form (no converstion of object etc), but in the migration project, Team is really interested in utilizing the OOP model of development where every information which is sent from BAL need to be converted to objects of its respective types (example employeeCollection, Address Collection etc).
If we have the static number of data returned from BAL we can have a class which contains those nodes as properties and we can access the same. But in our case the data returned from our BAL need to be customized. How can we handle the customization in presentation layer which is converting the result to an Object.
Below is an example of the XML returned
<employees>
<employee>
<firstName>Employee 1 First Name</firstName>
<lastName>Employee 1 Last Name</lastName>
<addresses>
<address>
<addressType>1</addressType>
<StreetName>Street name1</StreetName>
<RegionName>Region name</RegionName>
<address>
<address>
<addressType>2</addressType>
<StreetName>Street name2</StreetName>
<RegionName>Region name</RegionName>
<address>
<address>
<addressType>3</addressType>
<StreetName>Street name3</StreetName>
<RegionName>Region name</RegionName>
<address>
<addresses>
</employee>
<employee>
<firstName>Employee 2 First Name</firstName>
<lastName>Employee 2 Last Name</lastName>
<addresses>
<address>
<addressType>1</addressType>
<StreetName>Street name1</StreetName>
<RegionName>Region name</RegionName>
<address>
<address>
<addressType>2</addressType>
<StreetName>Street name2</StreetName>
<RegionName>Region name</RegionName>
<address>
<addresses>
</employee>
</employees>
If these are the only columns then i can write a class which is like
public class Address{
public int AddressType {get;set;};
public string StreetName {get;set;};
public string RegionName {get;set;};
}
public class Employee{
public string FirstName {get; set;}
public string LastName {get; set;}
public string AddressCollection {get; set;}
}
public class EmployeeCollection : List<Employee>{
public bool Add (Employee Data){
....
}
}
public class AddressCollection : List<Address>{
public bool Add (Address Data){
....
}
}
This class will be provided to customers and consultants as DLLs. We will not provide the source code for the same.
Now when the consultants or customers does customization(example adding country to address and adding passport information object with employee object) they must be able to access those properties in these classes, but without source code they will not be able to do those modifications.which makes the application useless. Is there is any way to acomplish this in DotNet.
I thought of using Anonymous classes but, the problem with Anonymous classes are
we can not have methods in it.
I am not sure how can i fit the collection objects (which will be inturn an anonymous class)
Not sure about datagrid / user control binding etc.
I also thought of using CODEDom to create classes runtime but not sure about the meory, performance issues. also the classes must be created only once and must use the same till there is another change.
Kindly help me out in this problem. Any kind of help meterial/ cryptic code/ links will be helpful.