This question is locked. New answers and comments are not allowed.
I am getting started with Data Access and I am trying to figure out how exactly one would go about creating the database from code when the classes you are mapping have calculated properties. For example, I have a class with the following property
public
double
SpaceTotal
{
get
{
return
Math.Round((
double
) spaceTotal/1073741824 - 0.005, 2); }
}
public
double
SpaceFree
{
get
{
return
Math.Round((
double
)spaceFree/1073741824 - 0.005, 2); }
}
public
double
SpaceFreeAsPercentageOfSpaceTotal
{
get
{
return
Math.Round(SpaceFree/SpaceTotal, 2) * 100.00; }
}
When I try to build my project I get the following error:
There is no field with name 'spaceFreeAsPercentageOfSpaceTotal' backing 'SpaceFreeAsPercentageOfSpaceTotal' property in type 'MyFluentProject.Data.Type.VMDrive'. You need to either change the Field Naming rules of the mapping configuration object or call HasFieldName(string) with the name of the backing field.
I am currently using default mapping and I am digging through the documentation for code-only development and I cannot find a code-only section that deals with setting up the database in-code from scratch when you have properties that are calculated using other properties of the same class.
Any ideas?