コード例 #1
0
        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);
                }
            }
        }
コード例 #2
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);
                }
            }
        }
 public void Generate_for_Id()
 {
     Assert.NotNull(ExpressionGenerator.CreateExpressionForProperty(typeof(ContentBase), "Id"));
 }
コード例 #4
0
 public void Generate_for_WebSite()
 {
     Assert.NotNull(ExpressionGenerator.CreateExpressionForProperty(typeof(Content), "WebSite"));
 }
コード例 #5
0
 public void Generate_for_Comments()
 {
     Assert.NotNull(ExpressionGenerator.CreateExpressionForProperty(typeof(Content), "Comments"));
 }
コード例 #6
0
 public void Generate_for_Author()
 {
     Assert.NotNull(ExpressionGenerator.CreateExpressionForProperty(typeof(Content), "Author"));
 }
コード例 #7
0
 public void Generate_for_Username()
 {
     Assert.NotNull(generator.CreateExpressionForProperty(typeof(WebUser), "Username"));
 }
コード例 #8
0
 public void Generate_for_ConfirmationKey()
 {
     Assert.NotNull(ExpressionGenerator.CreateExpressionForProperty(typeof(WebUser), "ConfirmationKey"));
 }
コード例 #9
0
 public void Generate_for_LastLogin()
 {
     Assert.NotNull(ExpressionGenerator.CreateExpressionForProperty(typeof(WebUser), "LastLogin"));
 }
コード例 #10
0
 public void Generate_for_BountCount()
 {
     Assert.NotNull(ExpressionGenerator.CreateExpressionForProperty(typeof(WebUser), "Confirmed"));
 }
コード例 #11
0
 public void Wont_Generate_for_Dummy()
 {
     Assert.Null(ExpressionGenerator.CreateExpressionForProperty(typeof(WebUser), "Dummy"));
 }