Last post Apr 11, 2012 09:25 PM by Decker Dong - MSFT
Apr 10, 2012 06:40 PM|tsoft|LINK
Hello, How can I get Dynamic Data to generate a ReadOnly field/column for my Entity? I've seen many folks give the example of a "Total" column that would take Quantity * Price and total it up. The general advice seems to be to "Put it in the database" -
so it gets transfered to the EntityFramework model.. The thing is, what if.. I want to get the data from somewhere else? For example I have a "IT_Server" class that has a computed property of "IsServerOn" and I want to run some code to determine that by..
say pinging the server quickly..
So I'd do something like this:
partial class IT_Servers : IAuditable
public class Metadata
public object Id;
public object ServerName;
public object IsServerOn;
[LazyLoad] // lazy loading would be neat to add later :)
public bool IsServerOn
How do I get it to show on the auto generated List and Edit pages?
Apr 11, 2012 09:25 PM|Decker Dong - MSFT|LINK
You should open SQL Management Studio first and set the default value for the totalColumn。And then for the Total property，plz just mark it with the data annotation——
1）[DataBaseGenerateOption(DataBaseGenerateOption.Computed)] （Code first）
2）For db-first，just open your edmx file and then create StoreGeneratedPattern="Identity" for you Total property。