public void Apply(IJoinedSubclassInstance instance) { var attribute = GetAttribute(instance.EntityType); if (attribute == null) { return; } instance.Table(attribute.TableName); if (!String.IsNullOrEmpty(attribute.Schema)) { instance.Schema(attribute.Schema); } }
/// <summary> /// Adds Module namespace to schema. /// </summary> /// <param name="instance">The instance.</param> public void Apply( IJoinedSubclassInstance instance ) { var namespaces = instance.EntityType.Namespace.Split ( ".".ToCharArray () ); foreach ( var ns in namespaces ) { if ( ns.Contains ( "Module" ) ) { instance.Schema ( ns ); break; } } var key = instance.EntityType.BaseType.Name + "Key"; instance.Key.Column ( key ); }
/// <summary> /// Adds Module namespace to schema. /// </summary> /// <param name="instance">The instance.</param> public void Apply(IJoinedSubclassInstance instance) { var namespaces = instance.EntityType.Namespace.Split(".".ToCharArray()); foreach (var ns in namespaces) { if (ns.Contains("Module")) { instance.Schema(ns); break; } } var key = instance.EntityType.BaseType.Name + "Key"; instance.Key.Column(key); }
/// <summary> /// Adds Module namespace to schema. /// </summary> /// <param name="instance">The instance.</param> public void Apply(IJoinedSubclassInstance instance) { var type = instance.EntityType; var schema = SchemaConvention.GetModuleName(type); var tableName = TableNameConvention.GetTableName(type); var attr = type.GetAttribute <MapTableAttribute>(); var key = instance.EntityType.BaseType.Name; key = $"{key}_Id"; key = attr?.PrimaryKey ?? key; key = key.ToLower(); if (!schema.IsNullOrEmpty()) { instance.Schema(schema); } instance.Table($"{tableName}"); instance.Key.Column(key); }
public void Apply(IJoinedSubclassInstance instance) { instance.Schema(Schema); instance.Table(instance.EntityType.Name + ConventionConstants.TableSuffix); instance.Key.Column(instance.EntityType.BaseType.Name + ConventionConstants.Id); }