예제 #1
0
        internal void MapProperties <T>(StructuralTypeConfiguration <T> configuration) where T : class
        {
            var metaDatas = QueryFluentMetadata.GetMetadataFor(typeof(T)).Properties;

            foreach (var data in metaDatas)
            {
                if (data.ModelName == null)
                {
                    continue;
                }
                if (!data.GetMaximumLength().HasValue&& !data.Required.HasValue)
                {
                    continue;
                }
                var methodInfo = PropertyMethodMapping.GetPropertyMappingMethod(
                    configuration.GetType(),
                    typeof(T),
                    data.ModelType);
                if (methodInfo == null)
                {
                    continue;
                }

                var lambda = ExpressionGenerator.CreateExpressionForProperty(typeof(T), data.ModelName);
                if (lambda != null)
                {
                    var propertyConfiguration = (PrimitivePropertyConfiguration)methodInfo.Invoke(configuration, new[] { lambda });

                    factory.Create(propertyConfiguration).Convert(data, propertyConfiguration);
                }
            }
        }
        internal void MapProperties(Type instanceType, StructuralTypeConfiguration configuration)
        {
            var metaDatas = query.GetMetadataFor(instanceType).Properties;

            foreach (var data in metaDatas)
            {
                if (data.ModelName == null)
                {
                    continue;
                }
                if (!data.StringLength.HasValue && !data.Required.HasValue)
                {
                    continue;
                }
                var methodInfo = methodMapping.GetPropertyMappingMethod(configuration.GetType(), instanceType,
                                                                        data.ModelType);
                if (methodInfo == null)
                {
                    continue;
                }

                var lambda = generator.CreateExpressionForProperty(instanceType, data.ModelName);
                if (lambda != null)
                {
                    var propertyConfiguration = (PropertyConfiguration)methodInfo.Invoke(configuration, new[] { lambda });

                    factory.Create(propertyConfiguration).Convert(data, propertyConfiguration);
                }
            }
        }
        internal void MapProperties(Type instanceType, StructuralTypeConfiguration configuration)
        {
            var metaDatas = query.GetMetadataFor(instanceType).Properties;

            foreach (var data in metaDatas)
            {
                if (data.ModelName == null)
                {
                    continue;
                }
                if (!data.StringLength.HasValue && !data.Required.HasValue)
                {
                    continue;
                }
                var methodInfo = methodMapping.GetPropertyMappingMethod(configuration.GetType(), instanceType,
                                                                        data.ModelType);
                if (methodInfo == null)
                {
                    continue;
                }

                var lambda = generator.CreateExpressionForProperty(instanceType, data.ModelName);
                if (lambda != null)
                {
                    var propertyConfiguration = (PropertyConfiguration) methodInfo.Invoke(configuration, new[] {lambda});

                    factory.Create(propertyConfiguration).Convert(data, propertyConfiguration);
                }
            }
        }