public void ApplyNullableIdConventionGeneric <TLinkedSource, TLinkTargetProperty, TLinkedSourceModelProperty>(ConventionMatch match, MethodInfo applyMethod)
            where TLinkedSource : ILinkedSource
            where TLinkedSourceModelProperty : struct
        {
            var parameters = new object[]
            {
                _loadLinkProtocolBuilder.For <TLinkedSource>(),
                FuncGenerator.GenerateFromGetter <TLinkedSource, TLinkedSourceModelProperty?>(
                    $"Model.{match.LinkedSourceModelProperty.Name}"
                    ),
                FuncGenerator.GenerateFromGetterAsExpression <TLinkedSource, TLinkTargetProperty>(match.LinkTargetProperty.Name),
                match.LinkedSourceModelProperty,
                match.LinkTargetProperty
            };

            applyMethod.Invoke(match.Convention, parameters);
        }
Пример #2
0
        public void ApplyMultiValueConventionGeneric <TLinkedSource, TLinkTargetProperty, TLinkedSourceModelProperty>(ConventionMatch match)
        {
            var getLinkTargetProperty = FuncGenerator.GenerateFromGetterAsExpression <TLinkedSource, IList <TLinkTargetProperty> >(
                match.LinkTargetProperty.Name
                );
            var getLinkedSourceModelProperty = FuncGenerator
                                               .GenerateFromGetter <TLinkedSource, IList <TLinkedSourceModelProperty> >(
                $"Model.{match.LinkedSourceModelProperty.Name}"
                );

            var casted = (IMultiValueConvention)match.Convention;

            casted.Apply(
                _loadLinkProtocolBuilder.For <TLinkedSource>(),
                getLinkedSourceModelProperty,
                getLinkTargetProperty, match.LinkedSourceModelProperty, match.LinkTargetProperty);
        }
Пример #3
0
        public void ApplyNullableValueTypeIdConventionGeneric <TLinkedSource, TLinkTargetProperty, TLinkedSourceModelProperty>(ConventionMatch match)
            where TLinkedSourceModelProperty : struct
        {
            var getLinkTargetProperty = FuncGenerator.GenerateFromGetterAsExpression <TLinkedSource, TLinkTargetProperty>(
                match.LinkTargetProperty.Name
                );
            var getLinkedSourceModelProperty = FuncGenerator
                                               .GenerateFromGetter <TLinkedSource, TLinkedSourceModelProperty?>(
                $"Model.{match.LinkedSourceModelProperty.Name}"
                );

            var casted = (IByNullableValueTypeIdConvention)match.Convention;

            casted.Apply(
                _loadLinkProtocolBuilder.For <TLinkedSource>(),
                getLinkedSourceModelProperty,
                getLinkTargetProperty, match.LinkedSourceModelProperty, match.LinkTargetProperty);
        }