namespace Yavsc.Models.Market { using System; using System.ComponentModel.DataAnnotations.Schema; public enum BillingMode {  Unitary, SetPrice, ByExecutionTime } public interface IUnit { string Name { get; } bool CanConvertFrom(IUnit other); VType ConvertFrom (IUnit other, VType orgValue) ; } public class Money : IUnit { public Money(string name, decimal euroExchangeRate) { Name = name; EuroExchangeRate = euroExchangeRate; } public string Name { get; private set ; } public decimal EuroExchangeRate { get; private set ; } public bool CanConvertFrom(IUnit other) { if (other is Money) return true; return false; } public decimal ConvertFrom(IUnit other, decimal orgValue) { if (other is Money) { var om = other as Money; return orgValue * om.EuroExchangeRate / EuroExchangeRate; } throw new NotImplementedException(); } } public partial class Service : BaseProduct { public string ContextId { get; set; } [ForeignKey("ContextId")] public virtual Activity Context { get; set; } public BillingMode? Billing { get; set; } // TODO public ServiceSpecification Specification { get; set; } /// /// In euro /// /// public decimal? Pricing { get; set; } } }