When generating an EditableChildList I am forced to provide a parent object as well as a child object. How could this be derived from the database?
In the MySample.xml, the ProjectResources collection lists the Parent relationship as "Project" and the Child as type "Resource" which works in this case.
However, what about a list of Departments where a Company object can expose a Departments property and also a User object can expose a Departments property. Who then would be the parent of the Departments ChildCollection? Or do I have to create separate collections called CompanyDepartments and UserDepartments. This seems like a big redundancy in functionality.
Thanks,
Will
<EDIT> I actually think this is an issue with the EditableChildList not recognizing that I am doing SplitBase instead of SplitPartial. The parent is required in the SplitPartial but shouldn't be in SplitBase. The ReadOnlyChildList, EditableChild and ReadOnlyChild objects all generate fine without a Parent relationship.</EDIT>
So
company.Departments would likey be an EditableList of Editable Departments whereas
user.Departments would likely be a ReadOnlyList of ReadOnly Departments
I get this, I'm just trying to get it from the database
Basically, what I am running into are the problems where I either will have to manage a hand crafted XML file with all objects, columns, relations, etc or figure out a complex way to use extended properties in SQL Server to accomplish this goal. Either case is not really desirable.
Will
Just makes me wonder why the entire section of Dollard's book on metadata extraction. I guess basically she is just saying "Hey, you can gather all of this info from your database but without extensive ORM files you won't really be able to generate anythin guseful from it". Maybe I'm missing something in her theories.
As I've stated before we really don't want to get into maintaining an extensive XML schema of our database where we'll have to go an hand edit the types on a field just because we changed a database column from int to float or something trivial, or even if we add a new column. We would like the ability to simply change the database, run an application to gather XML from the new database and then regenerate the business objects from the new set of XML.
Right now, the only way I see of accomplishing this is through very extensive use of extended properties which will likely get just as difficult to manage as an XML file.
Thanks,
Will
Thanks Rocky:
It certainly clairfies things but it makes them no easier. I guess right now we can use the generator on a case by case basis and simply forego the ability of mapping from a database to metadata to our business objects in a single fell swoop. Not the best solution ATM but at least a solution.
Unless I can come up with a consistent and easy to manage method of using extended procedures to handle this mapping for the most cases and then hand code the more complicated relationships.
Will
Something still confuses me though about the templates.
When generating split base classes, why is it that only the EditableChildList requires a parent object? Is it because the ReadOnlyChildList object never gets updated so this information doesn't need to be passed down from the parent?
Seems like the same issue would be required in the EditableChild since the parent object would update the child but for that template you are not required to supply a parent object.
Which gets back to my original post issue of is this intentional or a bug in the template since I can definitely see the need of having an EditableChildList of type Users (myUserList) included as a private member of multiple business objects (myDepartmentUsers, myApplicationUsers, myDivisionUsers) where in all of these cases it's a simple thing of wanting a collection of users with the ability to add and remove users from the collection from the parent object. I don't see a need to generate three different objects to handle these cases when a simple EditableChildList Users object would suffice in all cases. However, the code generator won't allow this unless I am missing something.
Will
On more reflection I guess I can see the need for individual objects here since myDepartment would need a list of users (select * from users where departmentID = myDepartmentID) so the criteria object here would be different than that in myDivisionUsers. These cases assume a user can oly be assigned to a single department, division, application.
I guess in reality I would go ahead and create a DepartmentUsers collection, DivisionUsers collection, etc. This would actually simplify the metadata extraction at the expense of generating a lot more business objects. I guess I can live with that.
Off to explore more options.
Will
BTW, you guys wil be more than welcome to a full description of whatever methods I end up using here (the templates as well).
Thanks for the patience here, I know most of the issues are from my lack of understanding.
Will
Copyright (c) Marimer LLC