public static EntityMapping <TEntity> Map <TEntity>(this DataContextMapping dataContextMapping, TableAttribute tableAttribute) where TEntity : class { var entityMapping = Map <TEntity>(dataContextMapping); entityMapping.TableAttribute = tableAttribute; return(entityMapping); }
protected override MetaModel CreateModel(Type dataContextType) { if (dataContextType == null) { throw ALinq.Error.ArgumentNull("dataContextType"); } DataContextMapping mapping = getMapping(dataContextType); //var type = dataContextType; //Debug.Assert(type != null); //while (mapping == null && type != typeof(DataContext).BaseType && type != null) //{ // contextMappings.TryGetValue(type, out mapping); // type = type.BaseType; //} if (mapping == null) { throw Error.CouldNotFindMappingForDataContextType(dataContextType); } var attributeProvider = new AttributeProvider(mapping); var model = new AttributedMetaModel(this, dataContextType, attributeProvider); return(model); }
public AttributeProvider(DataContextMapping mapping) { if (mapping == null) { throw Error.ArgumentNull("mapping"); } this.mapping = mapping; }
public static DataContextMapping <TContxt> Function <TContxt>(this DataContextMapping <TContxt> contextMapping, Expression <Func <TContxt, object> > predicate, FunctionAttribute function) where TContxt : DataContext { var mi = GetMember(predicate); return(Function(contextMapping, mi, function)); }
public static DataContextMapping <TContxt> Function <TContxt>(this DataContextMapping <TContxt> contextMapping, Expression <Func <TContxt, object> > member, bool isComposable, string name) where TContxt : DataContext { return(Function(contextMapping, member, new FunctionAttribute() { IsComposable = isComposable, Name = name })); }
public static EntityMapping <TEntity> Map <TContext, TEntity>(this DataContextMapping <TContext> dataContextMapping, Expression <Func <TContext, Table <TEntity> > > predicate) where TContext : DataContext where TEntity : class { var entityMapping = Map <TEntity>(dataContextMapping); return(entityMapping); }
public static FunctionAttribute GetFunction <TContxt>(this DataContextMapping <TContxt> entityMapping, Expression <Func <TContxt, object> > predicate) where TContxt : DataContext { var mi = GetMember(predicate); if (mi.DeclaringType != typeof(TContxt)) { throw Error.MappedMemberHadNoCorrespondingMemberInType(mi.Name, typeof(TContxt).Name); } return(entityMapping.GetFunction(mi)); }
static DataContextMapping <TContxt> Function <TContxt>(this DataContextMapping <TContxt> contextMapping, MemberInfo mi, FunctionAttribute function) where TContxt : DataContext { if (mi.DeclaringType != typeof(TContxt)) { throw Error.MappedMemberHadNoCorrespondingMemberInType(mi.Name, typeof(TContxt).Name); } contextMapping.Add(mi, function); return(contextMapping); }
public static EntityMapping <TEntity> Map <TEntity>(this DataContextMapping dataContextMapping) where TEntity : class { var entityMapping = dataContextMapping.GetEntityMapping <TEntity>(); if (entityMapping == null) { entityMapping = new EntityMapping <TEntity>(); } dataContextMapping.Add(entityMapping); return(entityMapping); }
public static DataContextMapping <TContxt> Function <TContxt>(this DataContextMapping <TContxt> contextMapping, Expression <Func <TContxt, object> > member) where TContxt : DataContext { return(Function(contextMapping, member, new FunctionAttribute())); }