The manager templates are more of a utility library, I don't think they're necessary in this case. I'll address your questions in detail below.
copperpot wrote:
We are evaluating LLBLGen Pro 2.5 as the ORM solution for an enterprise wide application framework.
In our environment, we have a team that builds a common layer which will contain entities that subsequent teams will extend or use as properties of their own custom entities.
For example:
Single Sql Server 2005 Database with the following hierarchy
- Person (supertype)
- Employee (subtype of Person)
- Manager (subtype of Employee)
- Department
Employees LLBLGen Project (target-per-entity inheritance)
- PersonEntity (supertype)
- n:1 relationship with DepartmentEntity
- EmployeeEntity (subtype)
- DepartmentEntity
- 1:n relationship with PersonEntity
Employee Service Visual Studio Project
- References EmployeesGeneric and EmployeesSpecific assemblies generated by LLBLGen Pro
Managers LLBLGen Project (target-per-entity inheritance)
- ManagerEntity (subtype of EmployeeEntity)
- Has a collection of EmployeeEntities
Manager Service Visual Studio Project
- Refs Employees Generic/Specific assemblies to provide PersonEntity & EmployeeEntity
- Refs Manager Generic/Specific assemblies to provide ManagerEntity
Keep in mind that creating parallel hierarchies isn't really helpful. With parallel hierarchies I mean the following:
If I have CustomerEntity which has a collection of OrderEntity instances as it has a 1:n relation with orderEntity, and I then create a MyCustomerEntity class that derives from CustomerEntity, that MyCustomerEntity still has a reference to a collection of OrderEntity. If I then also create a subtype of OrderEntity, MyOrderEntity, and create a reference to such a collection in MyCustomerEntity, I have a parallel hierarchy: Customer <- Order vs. MyCustomer <- MyOrder.
So I'm not entirely sure what you mean by "will contain entities that subsequent teams will extend or use as properties of their own custom entities."
If you want to create classes which aggregate entities, no problem. If you want to create new entities, map them to a database table/view or hierarchy of tables/views and you add a property to that class which refers to a different entity, and that property isn't mapped onto a relation, it gets complicated because that related entity isn't usable in hierarchy fetches of graphs, joins etc. : it's a class reference, not an entity relation.
Question #1:
Can entities defined in one LLBLGen project be extended by entities defined in a higher layer LLBLGen project?
What do you mean exactly with extended ?
Question #2
Can entities defined in one LLBLGen project be used as properties for an entity defined in a higher layer LLBLGen project?
Thanks.
You can always add a property, but it's not the same as having that property be mapped onto a relation.
To get back to your example, you should keep your hierarchies in the same project. The thing is that you can't mix them together, as they don't know eachother if they're not in the same project. So your manager in the managers project has a relation with employee. Though which one? The one in his project or in the Employees project?
So to solve this complexity, keep things together which relate to eachother. If you have separate sub domains in your domain, or subdomains which are related through non-inheritance entities, you could think of cutting the projects up in separate ones, with each one containing a subdomain and map the two entities which connect them twice: in each project the entity exists.
Of course, it doesn't really matter if you don't exchange entities between projects. After all, they all target the same database. So if a subsystem for managers works with a different set of entity definitions as another project, that's completely OK, the thing is that if you want to refer to 'EmployeeEntity' in a common layer, which one is that? The one in the employees project or the one in the managers project?