public void Apply(IClassInstance instance) { var tableAttr = instance.EntityType.GetCustomAttribute <TableAttribute>(); if (tableAttr != null) { if (!string.IsNullOrEmpty(tableAttr.Name)) { instance.Table(tableAttr.Name); } //TODO: unquote, prepend/append, quote if (!string.IsNullOrEmpty(tableAttr.Prefix)) { instance.Table($"`{tableAttr.Prefix}{instance.TableName.Trim('`')}`"); } if (!string.IsNullOrEmpty(tableAttr.Suffix)) { instance.Table($"`{instance.TableName.Trim('`')}{tableAttr.Suffix}`"); } if (tableAttr.View) { instance.ReadOnly(); instance.SchemaAction.None(); } } }
/// <summary> /// Sets table names in FluentNHibernate to the class name prefixed by the value in the SqlTableNamePrefix /// configuration key. /// </summary> public void Apply(IClassInstance instance) { string nameSpace = instance.EntityType.Namespace; if ((!string.IsNullOrEmpty(nameSpace)) && (nameSpace.StartsWith("BerwickHeights.Platform.PerfTest"))) { instance.Table("PERF_" + instance.EntityType.Name); } else { instance.Table(tableNamePrefix + instance.EntityType.Name); } }
public void Apply(IClassInstance instance) { if (instance.TableName != null) { instance.Table(AlterTableName(instance.TableName, "s")); } }
public void Apply(IClassInstance instance) { var desc = _descriptors.Where(d => d.Type == instance.EntityType).SingleOrDefault(); if (desc != null) { instance.Table(desc.TableName); } }
public void Apply(IClassInstance instance) { RecordBlueprint desc; if (_descriptors.TryGetValue(instance.EntityType, out desc)) { instance.Table(desc.TableName); } }
public void Apply(IClassInstance instance) { string entityTypeName = instance.EntityType.Name; string tableName = entityTypeName.ToUpperInvariant(); instance.Table(tableName); }
/// <summary> /// Applies the specified instance. /// </summary> /// <param name="instance">The instance.</param> public void Apply(IClassInstance instance) { if (typeof(ILookup).IsAssignableFrom(instance.EntityType)) { instance.Table(instance.EntityType.Name + "Lkp"); } }
public void Apply(IClassInstance instance) { var tableName = NameConventions.Quote(NameConventions.GetTableName(instance.EntityType)); instance.Table(tableName); instance.BatchSize(25); }
public void Apply(IClassInstance instance) { //Table name rule instance.Table(instance.EntityType.Name.ToPlural()); //To filter queries based on what I've defined in the Tenant filter definition instance.ApplyFilter <AppFilterDefinition>(); }
/// <summary> /// Applies the specified instance. /// </summary> /// <param name="instance">The instance.</param> public void Apply( IClassInstance instance ) { if ( typeof( ILookup ).IsAssignableFrom ( instance.EntityType ) ) { instance.Table ( instance.EntityType.Name + "Lkp" ); } }
public void Apply(IClassInstance instance) { instance.Schema(""); var tableName = NormaliseName(instance.TableName); instance.Table(tableName); }
public void Apply(IClassInstance instance) { string entityName = instance.EntityType.Name; string tableName = tablePrefix + entityName; instance.Table(tableName); }
public void Apply(IClassInstance instance) { string tableName = NameConventions.GetTableName(instance.EntityType); instance.Table(tableName); instance.BatchSize(25); }
public void Apply(IClassInstance instance) { var tablePrefix = string.Empty; var tableName = $"{tablePrefix}{Regex.Replace(instance.EntityType.Name, PascalCaseRegex, "_$1").Remove(0, 1)}".ToLower(); instance.Table(tableName); }
/// <summary> /// Apply changes to the target /// </summary> public override void Apply(IClassInstance instance) { base.Apply(instance); var tablePrefix = Options.TableNamePrefix ?? string.Empty; if (tablePrefix.IsNotWhiteSpace() && tablePrefix.EndsWith(Delimiter) == false) { tablePrefix += Delimiter; } var tableSurfix = Options.TableNameSurfix ?? string.Empty; if (tableSurfix.IsNotWhiteSpace() && tableSurfix.StartsWith(Delimiter) == false) { tableSurfix = Delimiter + tableSurfix; } var tableName = string.Concat(NHTool.EntityWrapperChar, tablePrefix, GetAbbrName(instance.EntityType.Name).ToOracleNaming(), tableSurfix, NHTool.EntityWrapperChar); instance.Table(tableName); }
public void Apply(IClassInstance instance) { string typeName = instance.EntityType.Name; var tableName = PluralizationService.CreateService(CultureInfo.CurrentCulture).Pluralize(typeName); var tableNameLowerCase = tableName.ToLower(); instance.Table(tableNameLowerCase); }
/// <summary> /// The apply. /// </summary> /// <param name="instance"> /// The instance. /// </param> public void Apply(IClassInstance instance) { instance.Table( string.Format( CultureInfo.InvariantCulture, FluentConfiguration.TableNameTemplate, instance.EntityType.Name)); }
public void Apply(IClassInstance instance) { if (instance.EntityType.Name == "Message") { instance.Table("jos_fb_messages"); } if (instance.EntityType.Name == "MessageText") { instance.Table("jos_fb_messages_text"); } if (instance.EntityType.Name == "UserProfile") { instance.Table("jos_fb_users"); } }
public void Apply(IClassInstance instance) { Type entityType = instance.EntityType; if (IsEcommerceType(entityType)) { instance.Table(GetTableName(instance.TableName)); } }
public void Apply(IClassInstance instance) { instance.LazyLoad(); var typeName = instance.EntityType.Name; var pluralTableName = Inflector.Inflector.Pluralize(typeName); instance.Table(pluralTableName); }
/// <summary> /// Applies the specified instance. /// </summary> /// <param name="instance">The instance.</param> public void Apply(IClassInstance instance) { var tableName = GetTableName(instance.EntityType).ToLower(); instance.Table($"{tableName}"); instance.ApplyFilter <AppFilterSoftDelete>(); }
/// <summary> /// Applies this table name convention to the specified <see cref = "IClassInstance" />. /// </summary> /// <param name="instance">An <see cref = "IClassInstance" />.</param> public void Apply(IClassInstance instance) { if (instance == null) { throw new ArgumentNullException("instance"); } instance.Table(instance.EntityType.Name.Pluralize()); }
public void Apply(IClassInstance instance) { if (instance.TableName.IsNotNull()) { instance.Table( string.Format("`{0}_{1}s`", Prefix, instance.TableName.ToLower().Replace("`", "")) ); } }
public void Apply(IClassInstance instance) { var schema = instance.EntityType.Namespace.Split('.').Last(); var typeName = instance.EntityType.Name; var tableName = default(string); instance.Table(tableName); }
public void Apply(IClassInstance instance) { instance.Table($"[{GetTableName(instance.EntityType)}]"); var schema = GetSchemaName(instance.EntityType, GetEntityAttribute(instance.EntityType)); if (!string.IsNullOrEmpty(schema)) { instance.Schema(schema); } }
public virtual void Apply(IClassInstance instance) { string tableName = instance.EntityType.Name.ToDatabaseName(); if (typeof(IPermanent).IsAssignableFrom(instance.EntityType)) { instance.ApplyFilter <IsDeletedFilter>("IS_DELETED = :DeleteFlag"); } instance.Table(tableName); }
public virtual void Apply(IClassInstance instance) { string tableName = instance.EntityType.Name.ToDatabaseName(); if (typeof (IPermanent).IsAssignableFrom(instance.EntityType)) { instance.ApplyFilter<IsDeletedFilter>("IS_DELETED = :DeleteFlag"); } instance.Table(tableName); }
public void Apply(IClassInstance instance) { var type = _types.FirstOrDefault(x => x == instance.EntityType); if (type != null) { var attr = type.GetCustomAttributes(typeof(CustomTableNameAttribute), true).FirstOrDefault() as CustomTableNameAttribute; if (attr != null) { instance.Table(attr.TableName); } ; var attr2 = type.GetCustomAttributes(typeof(TableAttribute), true).FirstOrDefault() as TableAttribute; if (attr2 != null) { instance.Table(attr2.Name); } } }
/// <summary> /// 클래스 인스턴스에 대한 Convention 적용 /// </summary> public override void Apply(IClassInstance instance) { base.Apply(instance); var tableName = string.Concat(NHTool.EntityWrapperChar, Options.TableNamePrefix.AsText(), GetAbbrName(instance.EntityType.Name), Options.TableNameSurfix.AsText(), NHTool.EntityWrapperChar); instance.Table(tableName); }
public void Apply(IClassInstance instance) { var entityType = instance.EntityType; if (MrCMSApp.AllAppTypes.ContainsKey(entityType) && MrCMSApp.AllAppTypes[entityType] == AmazonApp.AmazonAppName) { if (!entityType.IsSubclassOf(typeof(Document)) && !entityType.IsSubclassOf(typeof(UserProfileData)) && !entityType.IsSubclassOf(typeof(Widget))) { instance.Table(string.Format(AmazonApp.AmazonAppName+"_{0}", instance.TableName.Replace("`", ""))); } } }
public void Apply(IClassInstance instance) { var tableName = instance.TableName; var recIndex = tableName.IndexOf(Record); if (recIndex == -1) return; var recLength = Record.Length; Contract.Assume(recIndex + recLength < tableName.Length); instance.Table(tableName.Remove(recIndex, recLength)); }
public void Apply(IClassInstance instance) { var entityType = instance.EntityType; if (MrCMSApp.AllAppTypes.ContainsKey(entityType) && MrCMSApp.AllAppTypes[entityType] == AmazonApp.AmazonAppName) { if (!entityType.IsSubclassOf(typeof(Document)) && !entityType.IsSubclassOf(typeof(MessageTemplate)) && !entityType.IsSubclassOf(typeof(UserProfileData)) && !entityType.IsSubclassOf(typeof(Widget))) { instance.Table(string.Format(AmazonApp.AmazonAppName + "_{0}", instance.TableName.Replace("`", ""))); } } }
public void Apply(IClassInstance instance) { string className = instance.TableName.Replace("`", string.Empty); string tableName; if (className.EndsWith("y")) tableName = className.Substring(0, className.Length - 1) + "ies"; else tableName = className + "s"; instance.Table(tableName); }
public void Apply(IClassInstance instance) { //Table name rule var tableName = instance.EntityType.Name.ToPlural(); if (ConfigurationHelper.AppSettingsItem <bool>("UseLowercaseTableNames")) { tableName = tableName.ToLowerInvariant(); } instance.Table(tableName); //To filter queries based on what I've defined in the Tenant filter definition instance.ApplyFilter <AppFilterDefinition>(); }
public void Apply(IClassInstance instance) { var tableAttr = instance.EntityType.GetCustomAttribute <TableAttribute>(); var codeListAttr = instance.EntityType.GetCustomAttribute <CodeListConfigurationAttribute>(false); var isAssignableFromICodeList = instance.EntityType.IsAssignableFrom(typeof(ICodeList)); if (isAssignableFromICodeList) { if (tableAttr == null && codeListAttr?.CodeListPrefix == true) { instance.Table($"CodeList{instance.EntityType.Name}"); } } }
public void Apply(IClassInstance instance) { var attribute = GetAttribute(instance.EntityType); if (attribute == null) { return; } instance.Table(attribute.TableName); if (!String.IsNullOrEmpty(attribute.Schema)) { instance.Schema(attribute.Schema); } }
public void Apply(IClassInstance instance) { var tableName = instance.TableName; var recIndex = tableName.IndexOf(Record, StringComparison.Ordinal); if (recIndex == -1) { return; } var recLength = Record.Length; Contract.Assume(recIndex + recLength < tableName.Length); instance.Table(tableName.Remove(recIndex, recLength)); }
public void Apply(IClassInstance instance) { instance.Table(Inflector.Net.Inflector.Pluralize(instance.EntityType.Name)); }
public void Apply(IClassInstance instance) { //Adding a prefix so we don't get keyword conflicts i.e. 'cast' instance.Table("tbl_" + instance.EntityType.Name); }
public void Apply(IClassInstance instance) { var tableName = Inflector.Pluralize(instance.EntityType.Name); instance.Table(tableName); }
public void Apply(IClassInstance instance) { instance.Table(string.Format("`{0}`", Inflector.Pluralize(NamingHelper.GetPrefixedName(instance.EntityType)))); }
public void Apply(IClassInstance instance) { instance.Table($"[dbo].[{instance.EntityType.Name}]"); }
public void Apply(IClassInstance instance) { instance.Table(instance.EntityType.Name); }
public void Apply(IClassInstance instance) { instance.Table(StringHelper.ToLowerUnderscored(instance.EntityType.Name)); }
public void Apply(IClassInstance instance) { var typeName = instance.EntityType.Name; instance.Table(Inflector.Inflector.Pluralize(typeName)); }
public void Apply(IClassInstance instance) { instance.Table(instance.EntityType.Name.Pluralize()); }
public void Apply(IClassInstance instance) { instance.Table(string.Format("{0}{1}", "GL_", instance.EntityType.Name)); }
public void Apply(IClassInstance classMap) { classMap.Table(Inflector.Pluralize(classMap.EntityType.Name)); }
public void Apply(IClassInstance instance) { instance.Table(instance.EntityType.Name.ToPlural()); instance.BatchSize(250); }
public void Apply(IClassInstance instance) { instance.Table("[dbo].[" + instance.EntityType.Name + "]"); }
public void Apply(IClassInstance instance) { instance.Table(instance.EntityType.Name.Replace("Entity", "")); }
public void Apply(IClassInstance instance) { instance.Schema(Schema); instance.Table(instance.EntityType.Name + ConventionConstants.TableSuffix); }