コード例 #1
0
        public bool IsValidIntersection(
            IntersectCandidate <EntityModel, EntityField, TypeModel, PropertyInfoField> intersectCandidate,
            out IntersectedFields <EntityModel, EntityField, TypeModel, PropertyInfoField> intersectedFields
            )
        {
            if (intersectCandidate.RightField.FieldDataType.IsGenericType &&
                intersectCandidate.RightField.FieldDataType.GetGenericTypeDefinition() == typeof(IEntityReference <>) &&
                intersectCandidate.RightField.FieldDataType.GetGenericArguments()[0] == intersectCandidate.LeftField.FieldDataType)
            {
                var referenceKeys = intersectCandidate.LeftField.SubFields
                                    .Where(q => q.IsEntityLocalField)
                                    .ToArray();

                if (referenceKeys.Length == 1)
                {
                    intersectedFields = BuildIntersectedFields(
                        intersectCandidate.LeftField,
                        intersectCandidate.LeftPath.Child(referenceKeys[0]),
                        intersectCandidate.RightPath
                        );
                    return(true);
                }
            }

            intersectedFields = null;
            return(false);
        }
コード例 #2
0
 private ViewIntersectionField BuildReplacement(
     IntersectedFields <ViewIntersectionModel, ViewIntersectionField, EntityModel, EntityField> intersectedFields,
     FieldBuilder fieldBuilder
     )
 {
     intersectedFields.Dispatch(fieldBuilder);
     return(fieldBuilder.Field);
 }
コード例 #3
0
            void IIntersectedFieldsGenericExecutor.Execute <TLeftModel, TLeftField, TRightModel, TRightField, TLeftData, TRightData>(
                IntersectedFields <TLeftModel, TLeftField, TRightModel, TRightField, TLeftData, TRightData> intersectedFields
                )
            {
                var intersect = intersectedFields as IntersectedFields <ViewIntersectionModel, ViewIntersectionField, EntityModel, EntityField, TLeftData, TRightData>;

                Field = new ConvertedViewIntersectionField <TLeftData, TRightData>(
                    intersect.LeftField.FieldName, intersect.LeftField.CanRead, intersect.LeftField.CanWrite,
                    intersect.LeftField.DeclaringTypeModel, intersect.LeftField.OriginPropertyField,
                    intersect.LeftPath, intersect.GetConvertDelegate()
                    );
            }
コード例 #4
0
            void IIntersectedFieldsGenericExecutor.Execute <TLeftModel, TLeftField, TRightModel, TRightField, TLeftData, TRightData>(
                IntersectedFields <TLeftModel, TLeftField, TRightModel, TRightField, TLeftData, TRightData> intersectedFields
                )
            {
                var parser = TryParseFactory <string, TLeftData>();

                if (parser == null)
                {
                    throw new InvalidOperationException($"Can't determine method for parsing strings to type `{typeof(TLeftData).Name}`");
                }
                Factory = new PrimaryKeyEntityReferenceFactory <T, TLeftData>(
                    intersectedFields.RightPath as IFieldPath <TypeModel, PropertyInfoField>,
                    parser
                    );
            }
コード例 #5
0
 public virtual void AddIntersectedFields(IntersectedFields <ViewIntersectionModel, ViewIntersectionField, EntityModel, EntityField> intersectedFields)
 => _intersectedFields.Add(intersectedFields);
コード例 #6
0
 public MapLastIdResultProcessor(TView view,
                                 IntersectedFields <EntityModel, EntityField, TypeModel, PropertyInfoField> primaryKeyIntersectedFields)
 {
     _view = view;
     _primaryKeyIntersectedFields = primaryKeyIntersectedFields;
 }