Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
EF and extra properties
Message
De
11/09/2012 16:16:16
John Baird
Coatesville, Pennsylvanie, États-Unis
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Entity Framework
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01552736
Message ID:
01552740
Vues:
90
This message has been marked as the solution to the initial question of the thread.
>>>Hi everybody,
>>>
>>>I am creating the classes for my tables by hand - I am working on a utility application which I already wrote in VFP and I am working on ASP.NET MVC version of it.
>>>
>>>In one of the queries I use the following
>>>
>>>select Table.Col1, Table.Col2, Table.End_Num - Table.Start_Num + 1 as quantity from myTable Table.
>>>
>>>I've checked this link
>>>http://stackoverflow.com/questions/6944904/how-should-i-access-a-computed-column-in-entity-framework-code-first
>>>
>>>but it is still not clear to me. I don't have this column as computed in my database, but I think it will be nice to have it as a property in the class. The question is - how should I define such property which is not a column in a table but rather some simple computed expression?
>>>
>>>Thanks in advance.
>>
>>try a google search... add computed properties to entity framework model
>
>Yes, all Google searches result in StackOverflow questions so far and they don't yet explain what I'm asking. I don't have the computed column in the database and I don't want to add it to the table. So, should it be something like
>
>class ClientOrder
>{
>ClientOrder
>{
>   this.Quantity = this.EndNum - this.StartNum + 1;
>}
>
>[Computed] // Do I need this attribute here?
>public virtual Quantity {set;}
>}    
>
In the spare 2 minutes before replying, did you google what I posted. I get a link that tells you exactly what to do and its not expert's exchange. Why don't you try to figure it out for a while before asking others to do your work for you...
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform