public override object GetValue(object obj, IDictionary <string, IExtendedResourceProxy> cache)
        {
            IExtendedResourceProxy extendedResource;
            var underlyingResource = UnderlyingProperty.GetValue(obj, null);

            if (TryGetFromCache(cache, underlyingResource, out extendedResource))
            {
                return(extendedResource);
            }
            if (underlyingResource != null)
            {
                extendedResource =
                    (IExtendedResourceProxy)
                    createProxyListMethod.MakeGenericMethod(Info.ExtendedType, Info.ServerType).Invoke(null,
                                                                                                       new object[]
                {
                    underlyingResource,
                    Info
                });
            }
            else
            {
                extendedResource = null;
            }
            cache[Property.Name] = extendedResource;
            return(extendedResource);
        }
示例#2
0
        public override object GetValue(object obj, IDictionary <string, IExtendedResourceProxy> cache)
        {
            IExtendedResourceProxy extendedResource;
            var underlyingResource = UnderlyingProperty.GetValue(obj, null);

            if (TryGetFromCache(cache, underlyingResource, out extendedResource))
            {
                return(extendedResource);
            }

            if (underlyingResource != null)
            {
                extendedResource =
                    (IExtendedResourceProxy)
                    RuntimeProxyFactory.Create(typeof(ExtendedResourceBase), Property.PropertyType);
                var proxyBase = (ExtendedResourceBase)extendedResource;
                proxyBase.Initialize(ClientTypeResolver.Default, Info, underlyingResource);
            }
            else
            {
                extendedResource = null;
            }
            cache[Property.Name] = extendedResource;
            return(extendedResource);
        }
示例#3
0
        public override bool Equals(object o)
        {
            ProjectingPropertyInfo other = o as ProjectingPropertyInfo;

            return(other != null &&
                   Projector == other.Projector &&
                   UnderlyingProperty.Equals(other.UnderlyingProperty));
        }
示例#4
0
        public override bool Equals(object o)
        {
            InheritedPropertyInfo other = o as InheritedPropertyInfo;

            return(other != null &&
                   UnderlyingProperty.Equals(other.UnderlyingProperty) &&
                   ReflectedType.Equals(other.ReflectedType));
        }
        public override MethodInfo GetSetMethod(bool nonPublic)
        {
            MethodInfo underlyingSetter = UnderlyingProperty.GetSetMethod(nonPublic);

            if (underlyingSetter == null)
            {
                return(null);
            }
            else
            {
                return(new InheritedMethodInfo(underlyingSetter, _reflectedType));
            }
        }
示例#6
0
        public override void SetValue(object obj, object value, IDictionary <string, IExtendedResourceProxy> cache)
        {
            if (value == null)
            {
                cache.Remove(Property.Name);
                UnderlyingProperty.SetValue(obj, null, null);
                return;
            }
            var extendedResource   = (IExtendedResourceProxy)value;
            var underlyingResource = extendedResource.WrappedResource;

            UnderlyingProperty.SetValue(obj, underlyingResource, null);
            cache[Property.Name] = extendedResource;
        }
        public override AssetValuation Calculate(IInstrumentControllerData modelData)
        {
            ModelData = modelData;
            AnalyticModelParameters = null;
            AnalyticsModel          = new PropertyTransactionAnalytic();
            //1. Create the property
            var metrics         = ResolveModelMetrics(AnalyticsModel.Metrics);
            var metricsAsString = metrics.Select(metric => metric.ToString()).ToList();
            //TODO Find the correct curve.
            var controllerData = PriceableAssetFactory.CreateAssetControllerData(metricsAsString.ToArray(), modelData.ValuationDate, modelData.MarketEnvironment);

            //UnderlyingFutures.EquityCurveName = CurveNameHelpers.GetEquityCurveName(FuturesTypeInfo.Future.currency.Value, ReferenceContract);
            //UnderlyingFutures.Multiplier = Multiplier;
            UnderlyingProperty.Calculate(controllerData);
            // store inputs and results from this run
            //AnalyticModelParameters = ((PriceableFutureAssetController)UnderlyingFutures).AnalyticModelParameters;
            //AnalyticsModel = ((PriceableIRFuturesAssetController)UnderlyingFutures).AnalyticsModel;
            //CalculationResults = ((PriceableEquityAssetController)UnderlyingFutures).CalculationResults;
            CalculationPerformedIndicator = true;
            return(GetValue(CalculationResults, modelData.ValuationDate));
        }
 public override bool Equals(object o)
 {
     return(o is ProjectingPropertyInfo other &&
            Projector == other.Projector &&
            UnderlyingProperty.Equals(other.UnderlyingProperty));
 }
 public override int GetHashCode()
 {
     return(Projector.GetHashCode() ^ UnderlyingProperty.GetHashCode());
 }
示例#10
0
 public override bool Equals([NotNullWhen(true)] object?o)
 {
     return(o is ProjectingPropertyInfo other &&
            Projector == other.Projector &&
            UnderlyingProperty.Equals(other.UnderlyingProperty));
 }
示例#11
0
 protected override IEnumerable <CSharpAttributeData> GetCustomAttributesToEmit(PEModuleBuilder moduleBuilder)
 {
     return(UnderlyingProperty.GetCustomAttributesToEmit(moduleBuilder));
 }
 public override int GetHashCode()
 {
     return(UnderlyingProperty.GetHashCode() ^ ReflectedType.GetHashCode());
 }
示例#13
0
 protected override IEnumerable <CSharpAttributeData> GetCustomAttributesToEmit(ModuleCompilationState compilationState)
 {
     return(UnderlyingProperty.GetCustomAttributesToEmit(compilationState));
 }
示例#14
0
 protected override IEnumerable <CSharpAttributeData> GetCustomAttributesToEmit()
 {
     return(UnderlyingProperty.GetCustomAttributesToEmit());
 }
示例#15
0
 public override bool Equals([NotNullWhen(true)] object?o)
 {
     return(o is InheritedPropertyInfo other &&
            UnderlyingProperty.Equals(other.UnderlyingProperty) &&
            ReflectedType.Equals(other.ReflectedType));
 }
示例#16
0
 public override ImmutableArray <CSharpAttributeData> GetAttributes() => UnderlyingProperty.GetAttributes();