example:
step 1:Crate Main class:
public class Output//Main class
{
public long Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public double EstValue { get; set; }
public long PhaseId { get; set; }
[JsonIgnore]
public Phase Phase { get; set; }
// public abstract double Total();
public OutputCategory OutputCategory { get; set; }
}
step 2:
Relationship Output calss :
public class ServiceDeliveryOutput:Output
{
public double NumberOfUnit { get; set; }
public Money RevenueGenerated { get; set; }
public Money EstimatedUnitValue { get; set; }
public ServiceDeliveryOutput()
{
RevenueGenerated = new Money();
EstimatedUnitValue = new Money();
}
public Money Total()
{
throw new NotImplementedException();
}
public class ReachNIntermediateOutcome:Output
{
public double Numerator { get; set; }
public double Denominator { get; set; }
public double Total()
{
throw new NotImplementedException();
}
}
}
step 3:
Then we SET Mapping in db Context :
modelBuilder.Entity<ServiceDeliveryOutput>().Map(m =>
{
m.MapInheritedProperties();
m.ToTable("ServiceDeliveryOutputs");
});
modelBuilder.Entity<ReachNIntermediateOutcome>().Map(m =>
{
m.MapInheritedProperties();
m.ToTable("ReachNIntermediateOutcomes");
});
Enj..Hope it will help u..all the best....
No comments:
Post a Comment