This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Does LightSpeed offer support for the concept of Components the way that NHibernate does? Basically its a way to define composition in a single table. For example Account -> RentalMambership, but all the data for both classes is stored in the accounts table. This way I can define a more fine grained object model as opposed to having all of the data regarding RentalMembership stuffed into the account class.
Thanks, Jesse |
|
|
Hi Jesse, LightSpeed does not currently support this but it is on my list and I'm going to try and get it in for 1.0. My current line of thinking is that such components should always be value objects and therefore structs - is this how you would want to represent it? Cheers, Andrew. |
|
|
Conceptually you might look at them as value objects but I dont know if I would put a requirement on them to be structs as this may be to limiting and may not fit for a use case that i cant readily think of right now. |
|
|
I was just thinking. I try to never use a struct unless it is immutable. I can see many times when i would want to edit the values of a component. Take Person -> Address as an example. If address was a component i would definitely want to edit the address. Also in case you havent thought about this, sometimes its nice for components to be able to reference the parent object. This is necessary if the component needs to do some rule checking that involves data from the parent. |
|
|
[quote user="jnapier"] I was just thinking. I try to never use a struct unless it is immutable. I can see many times when i would want to edit the values of a component. Take Person -> Address as an example. If address was a component i would definitely want to edit the address.[/quote] Yes you need to be able to edit the address. The way you do this with a value object is by creating a new one. Such components are value objects as they have no identity. [quote user="jnapier"]Also in case you havent thought about this, sometimes its nice for components to be able to reference the parent object. This is necessary if the component needs to do some rule checking that involves data from the parent. [/quote] Makes sense. |
|