|
Hi,
I have a list of objects that have to int properties. The list is the output of anothre linq query. The object:
public class DimensionPair { public int Height { get; set; } public int Width { get; set; }
I want find and return the object in the list...
Started by theringostarrs on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
With the same MAX value, only one will be grabbed:
private void Test() { test v1 = new test(); v1.Id through the data, remembering the maximum element we've seen so far and the maximum value it produced the maximum value on every....
|
|
I'm new to DDD and trying hard to understand some of the concepts. How do you determine in your domain what objects are Entity objects and which ones are Value objects, and how exactly are they treated differently?
Started by Micah on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
An identity, whereas value objects do not carry any special meaning to the business (think MonetaryAmount.
|
|
How do you choose between implementing a value object (the canonical example being an address) as an immutable object or a struct?
Are there performance, semantic or any other benefits of choosing one over the other?
Started by Garry Shutler on
, 11 posts
by 11 people.
Answer Snippets (Read the full thread at stackoverflow):
ArgumentOutOfRangeException("value"); } _value = value; } public override bool Equals(object obj you choose between implementing a value object (the canonical example being an addressI like to use a thought experiment....
|
Ask your Facebook Friends
|
I want to use object's field's value while creating another object using literal notation:
var T = { fieldName : 'testField' }; /* // Doesn't work. var test = { T.fieldName : 'value' }; */ // Does work. var test = []; test[T.fieldName] = 'value'; alert...
Started by Li0liQ on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Var test = {}; test[T.fieldName] = 'value'; alert(test.testField); // alerts "value"
Which is what....
The value 'value' will be stored' }; // Does work.
value' }; alert(test.testField); // test
That should not work.
|
|
Can someone post an example of how I get an instance variable value that is a double? I tried using the object_getIvar() function but that didn't go very well because it seems like this function is only good for variables that return objects and not scalar...
Started by ForeignerBR on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
object_getIvar() is something lower-level"]; then you can get the double....
With double value of an object x is called "weight", you do NSNumber* x=[obj valueForKey:@"weight a double value by [obj setValue:num forKey:@"weight"] .
|
|
Hey everyone,
I'm trying to design a pretty simple app and am getting myself a bit confused with Hibernate's definition of entity and value objects (as defined in Chapter 4 of Java Persistence with Hibernate).
What I have is an app with customers, who...
Started by Denise on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Object of Entity Type : has its own database identity Object of Value Type : belongs)
- OrderLine
Hibernate's documentation makes a distinction between Entity Type and Value Type , not Value to an entity....
Object.
|
|
I have a list with objects of x type. Those objects have an attribute name. I want to find if a string matchs any of those object names. If I would have a list with the object names I just would do if string in list , so I was wondering given the current...
Started by Pablo on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
That you're going to fetch objects by the string value of an attribute, do not use a list, use a dictionary.
|
|
I have this code:
foreach ($this->configObjects as $k=>$object) { $configObject=$object; //Here I will make a lot of changes to $configObject, however // I want all those changes to be kept only to the local copy of $configObject, // So the next...
Started by Click Upvote on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
Putting an '&' would pass....
Question 1: The for each loop to that foreach.
Use a copy constructor.
By defualt should make a local copy of the value into your '$k=>$object' - any changes localwell, you simply clone your object.
|
|
Obviously I am wrong in saying that DDD is similar to EAV/CR in usefulness, but the only difference I see so far is physical tables build for each entity with lots of joins rather than three tables and lots of joins.
This must be due to my lack of DDD...
Started by Dr. Zim on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
-driven design proponents often recommend keeping the data model as close to the object model as possible in your object-relational mapping layer to transform (project) your data into your ....
The need for the value object.
|
|
I'm seeking advice on doing the following in a more pythonic way.
Consider:
class MyObj(object): def __init__(self): self.dict_properties = {}
Suppose I've got a list which contains multiple MyObj instances:
mylist = [<__main__.MyObj object at 0x10...
Started by ChristopheD on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
You could reach for operator and try to compose an attrgetter... .
Mylist.sort(key=lambda x: x.dict_properties['mykey'])
is way simpler, and faster.
I'd just do:
mylist.sort(key=lambda o: o.dict_properties["kykey"])
You could also overide cmp on the class .
|