internal static Type[] GetReferencedTypes(DataAccessModelConfiguration configuration, PropertyInfo propertyInfo, Type[] referencedTypes) { var retval = new List<Type>(); if (configuration.ReferencedTypes != null) { retval.AddRange(configuration.ReferencedTypes); } if (referencedTypes != null) { retval.AddRange(referencedTypes); } if (propertyInfo?.PropertyType != null) { retval.Add(propertyInfo.PropertyType); } if (propertyInfo?.DeclaringType != null) { retval.Add(propertyInfo.DeclaringType); } return retval.ToArray(); }
internal static Type[] GetReferencedTypes(DataAccessModelConfiguration configuration, PropertyInfo propertyInfo, Type[] referencedTypes) { var retval = new List <Type>(); if (configuration.ReferencedTypes != null) { retval.AddRange(configuration.ReferencedTypes); } if (referencedTypes != null) { retval.AddRange(referencedTypes); } if (propertyInfo?.PropertyType != null) { retval.Add(propertyInfo.PropertyType); } if (propertyInfo?.DeclaringType != null) { retval.Add(propertyInfo.DeclaringType); } return(retval.ToArray()); }
private Type[] GetReferencedTypes(DataAccessModelConfiguration configuration, PropertyInfo propertyInfo) { var referencedTypes = new List <Type>(); if (configuration.ReferencedTypes != null) { referencedTypes.AddRange(configuration.ReferencedTypes); } if (this.ReferencedTypes != null) { referencedTypes.AddRange(this.ReferencedTypes); } if (this.ReferencedType != null) { referencedTypes.Add(this.ReferencedType); } if (propertyInfo?.PropertyType != null) { referencedTypes.Add(propertyInfo.PropertyType); } if (propertyInfo?.DeclaringType != null) { referencedTypes.Add(propertyInfo.DeclaringType); } return(referencedTypes.ToArray()); }
private Type[] GetReferencedTypes(DataAccessModelConfiguration configuration, PropertyInfo propertyInfo) { var referencedTypes = new List<Type>(); if (configuration.ReferencedTypes != null) { referencedTypes.AddRange(configuration.ReferencedTypes); } if (this.ReferencedTypes != null) { referencedTypes.AddRange(this.ReferencedTypes); } if (this.ReferencedType != null) { referencedTypes.Add(this.ReferencedType); } if (propertyInfo?.PropertyType != null) { referencedTypes.Add(propertyInfo.PropertyType); } if (propertyInfo?.DeclaringType != null) { referencedTypes.Add(propertyInfo.DeclaringType); } return referencedTypes.ToArray(); }
public static DataAccessModel BuildDataAccessModel(Type dataAccessModelType, DataAccessModelConfiguration configuration) { if (!dataAccessModelType.IsSubclassOf(typeof(DataAccessModel))) { throw new ArgumentException("Data access model type must derive from DataAccessModel", nameof(dataAccessModelType)); } configuration = configuration ?? GetDefaultConfiguration(dataAccessModelType); if (configuration == null) { throw new InvalidOperationException("No configuration specified or declaredd"); } var buildInfo = CachingDataAccessModelAssemblyProvider.Default.GetDataAccessModelAssembly(dataAccessModelType, configuration); var retval = buildInfo.NewDataAccessModel(); retval.SetConfiguration(configuration); retval.SetAssemblyBuildInfo(buildInfo); retval.hasAnyAutoIncrementValidators = retval.TypeDescriptorProvider.GetTypeDescriptors().Any(c => c.PersistedProperties.Any(d => d.IsAutoIncrement && d.AutoIncrementAttribute.ValidateExpression != null)); retval.Initialise(); return(retval); }
public static DataAccessModel BuildDataAccessModel(Type dataAccessModelType, DataAccessModelConfiguration configuration) { if (!dataAccessModelType.IsSubclassOf(typeof(DataAccessModel))) { throw new ArgumentException("Data access model type must derive from DataAccessModel", nameof(dataAccessModelType)); } configuration = configuration ?? GetDefaultConfiguration(dataAccessModelType); if (configuration == null) { throw new InvalidOperationException("No configuration specified or declaredd"); } var buildInfo = CachingDataAccessModelAssemblyProvider.Default.GetDataAccessModelAssembly(dataAccessModelType, configuration); var retval = buildInfo.NewDataAccessModel(); retval.SetConfiguration(configuration); retval.SetAssemblyBuildInfo(buildInfo); retval.Initialise(); return(retval); }
public LambdaExpression GetSetLambdaExpression(DataAccessModelConfiguration configuration, PropertyInfo propertyInfo) { return(this.SetExpression == null ? null : ComputedExpressionParser.Parse(this.SetExpression, propertyInfo, GetReferencedTypes(configuration, propertyInfo, this.ReferencedTypes?.ConcatUnlessNull(this.ReferencedType).ToArray()), propertyInfo.PropertyType)); }
public LambdaExpression GetSetLambdaExpression(DataAccessModelConfiguration configuration, PropertyInfo propertyInfo) { return(this.SetExpression == null ? null : ComputedExpressionParser.Parse(this.SetExpression, propertyInfo, GetReferencedTypes(configuration, propertyInfo))); }
public LambdaExpression GetValidateLambdaExpression(DataAccessModelConfiguration configuration, PropertyInfo propertyInfo) { return(this.ValidateExpression == null ? null : ComputedExpressionParser.Parse(this.ValidateExpression, propertyInfo, ComputedMemberAttribute.GetReferencedTypes(configuration, propertyInfo, this.ReferencedTypes?.ConcatUnlessNull(this.ReferencedType).ToArray()), typeof(bool))); }
public LambdaExpression GetSetLambdaExpression(DataAccessModelConfiguration configuration, PropertyInfo propertyInfo) { return this.SetExpression == null ? null : ComputedExpressionParser.Parse(this.SetExpression, propertyInfo, GetReferencedTypes(configuration, propertyInfo, this.ReferencedTypes?.ConcatUnlessNull(this.ReferencedType).ToArray()), propertyInfo.PropertyType); }
public LambdaExpression GetSetLambdaExpression(DataAccessModelConfiguration configuration, PropertyInfo propertyInfo) { return this.SetExpression == null ? null : ComputedExpressionParser.Parse(this.SetExpression, propertyInfo, GetReferencedTypes(configuration, propertyInfo)); }
internal void SetConfiguration(DataAccessModelConfiguration configuration) { this.Configuration = configuration; }
public static T BuildDataAccessModel <T>(DataAccessModelConfiguration configuration) where T : DataAccessModel { return((T)BuildDataAccessModel(typeof(T), configuration)); }
public LambdaExpression GetValidateLambdaExpression(DataAccessModelConfiguration configuration, PropertyInfo propertyInfo) { return this.ValidateExpression == null ? null : ComputedExpressionParser.Parse(this.ValidateExpression, propertyInfo, ComputedMemberAttribute.GetReferencedTypes(configuration, propertyInfo, this.ReferencedTypes?.ConcatUnlessNull(this.ReferencedType).ToArray()), typeof(bool)); }