public RFIOBehaviourAttribute(RFIOBehaviour ioBehaviour, bool isMandatory = true) { IOBehaviour = ioBehaviour; IsMandatory = isMandatory; }
protected RFGraphProcessDefinition AddIOMapping <S>(Expression <Func <S, object> > property, RFCatalogKey key, RFIOBehaviour expectedBehvaiour, Func <RFGraphInstance, List <RFDate> > rangeRequestFunc = null, Func <RFGraphInstance, RFDate> rangeUpdateFunc = null) where S : RFGraphProcessorDomain { var processor = Processor(); var domain = processor.CreateDomain(); if (domain.GetType() != typeof(S)) { throw new RFLogicException(this, "IO Domain Type mismatch on processor {0}: {1} vs {2}", RFGraphDefinition.GetFullName(GraphName, Name), domain.GetType().Name, typeof(S).Name); } var propertyInfo = property.GetProperty <S>(); var ioBehaviour = RFReflectionHelpers.GetIOBehaviour(propertyInfo); if (ioBehaviour != expectedBehvaiour) { throw new RFLogicException(this, "Inconsistent IO direction {0} on property {1}, expected {2}.", ioBehaviour, propertyInfo.FullName(), expectedBehvaiour); } var dateBehaviour = RFReflectionHelpers.GetDateBehaviour(propertyInfo); if (dateBehaviour == RFDateBehaviour.Range && (rangeRequestFunc == null || rangeUpdateFunc == null)) { throw new RFLogicException(this, "Range input doesn't have range functions specified on property {0}.", propertyInfo.FullName()); } IOMappings.Add(new RFGraphIOMapping { Key = key, Property = propertyInfo, RangeRequestFunc = rangeRequestFunc, RangeUpdateFunc = rangeUpdateFunc, DateBehaviour = dateBehaviour }); return(this); }