Basically, it's the simple scenario of needing to populate a dropdown with LastName, FirstName by combining the two columns in the entity to FullName. I'd like it to live in the entity so I can grab it whenever I find a use for it. Is this possible?
+2
A:
I would add a partial class that has the FullName property. Have a look at the designer file for your data context classes for the namespace and partial classname to use.
namespace your.namespace {
public partial class yourclassname {
public string FullName {
get { return string.format("{0} {1}", FirstName, LastName); }
}
}
}
wulimaster
2009-02-03 04:52:47
I believe this gave me some "not an updateable SQL something something" error when I tried this initially? I'll have to check again but it there's some trick to it?
EdenMachine
2009-02-03 22:00:29
ah sweet - that worked. I swear I tried that before but I must have had some minor difference in mine. thanks!!!
EdenMachine
2009-02-04 05:00:34
Only problem I have had is for a stored procedure result object....it will throw an error on those....something about a property without a setter. I believe you can "trick" those by decorating the partial class with a [Table] attribute.
wulimaster
2009-02-04 23:09:49