public void Apply(IClassInstance instance) { string tableName = NameConventions.GetTableName(instance.EntityType); instance.Table(tableName); instance.BatchSize(25); }
public void Apply(IClassInstance instance) { if (IsCacheable(instance.EntityType)) { instance.Cache.ReadWrite(); } }
public void Apply(IClassInstance instance) { if (instance.TableName != null) { instance.Table(AlterTableName(instance.TableName, "s")); } }
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(); } } }
public void Apply(IClassInstance instance) { var tableName = NameConventions.Quote(NameConventions.GetTableName(instance.EntityType)); instance.Table(tableName); instance.BatchSize(25); }
public void Apply(IClassInstance instance) { if (instance.EntityType.IsSubclassOf(typeof (SiteEntity))) { instance.ApplyFilter<SiteFilter>(); } }
/// <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" ); } }
private void ApplyConventionForSubclasses(IClassInstance instance) { foreach (var subClassInspector in instance.Subclasses) { ApplyConventionForSubclasses(instance, subClassInspector); } }
public void Apply(IClassInstance instance) { string entityName = instance.EntityType.Name; string tableName = tablePrefix + entityName; instance.Table(tableName); }
public void Apply(IClassInstance instance) { foreach (var item in instance.References) { SetManyToOneForeignKey(item, instance); } }
/// <summary> /// Sets read-only if ILookup. /// </summary> /// <param name="instance">The instance.</param> public void Apply( IClassInstance instance ) { if ( typeof( ILookup ).IsAssignableFrom ( instance.EntityType ) ) { instance.ReadOnly (); } }
public void Apply(IClassInstance instance) { string entityTypeName = instance.EntityType.Name; string tableName = entityTypeName.ToUpperInvariant(); instance.Table(tableName); }
public void Apply(IClassInstance instance) { RecordBlueprint desc; if (_descriptors.TryGetValue(instance.EntityType, out desc)) { instance.Table(desc.TableName); } }
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>(); }
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) { instance.Schema(""); var tableName = NormaliseName(instance.TableName); 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); }
/// <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) { if (typeof(ISoftDeletable).IsAssignableFrom(instance.EntityType)) { instance.ApplyFilter<SoftDeletableFilter>(); } }
public void Apply(IClassInstance instance) { entities.Add(instance.EntityType, instance); ApplyConventionForReferences(instance); ApplyConventionForProperties(instance); ApplyConventionForSubclasses(instance); }
public void Apply(IClassInstance instance) { if (instance.EntityType.IsSubclassOf(typeof(SiteEntity))) { instance.ApplyFilter <SiteFilter>(); } }
public void Apply(IClassInstance instance) { if (typeof(ISoftDeletable).IsAssignableFrom(instance.EntityType)) { instance.ApplyFilter <SoftDeletableFilter>(); } }
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> /// Sets read-only if ILookup. /// </summary> /// <param name="instance">The instance.</param> public void Apply(IClassInstance instance) { if (typeof(ILookup).IsAssignableFrom(instance.EntityType)) { instance.ReadOnly(); } }
/// <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)); }
/// <summary> /// Applies the schema name for the module. /// </summary> /// <param name="instance">The instance.</param> public void Apply(IClassInstance instance) { //Derive Schema var type = instance.EntityType; var moduleName = GetModuleName(type); instance.Schema(moduleName); }
public void Apply(IClassInstance instance) { instance.LazyLoad(); var typeName = instance.EntityType.Name; var pluralTableName = Inflector.Inflector.Pluralize(typeName); instance.Table(pluralTableName); }
public void Apply(IClassInstance instance) { Type entityType = instance.EntityType; if (IsEcommerceType(entityType)) { instance.Table(GetTableName(instance.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> /// 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 the schema name for the module. /// </summary> /// <param name="instance">The instance.</param> public void Apply( IClassInstance instance ) { //Derive Schema var type = instance.EntityType; var moduleName = GetModuleName ( type ); instance.Schema ( moduleName ); }
public void Apply(IClassInstance instance) { instance.Cache.ReadWrite(); instance.Cache.Region(instance.EntityType.FullName); //instance.Cache.IncludeAll(); }
public void Apply(IClassInstance instance) { if (instance.TableName.IsNotNull()) { instance.Table( string.Format("`{0}_{1}s`", Prefix, instance.TableName.ToLower().Replace("`", "")) ); } }
/// <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 (typeof(NamedEntity <Guid?>).IsAssignableFrom(instance.EntityType)) { instance. Cache. NonStrictReadWrite(); } }
/// <summary> /// Apply changes to the target /// </summary> public void Apply(IClassInstance instance) { var proxy = GetProxyType(instance.EntityType); if (proxy != null) { instance.Proxy(proxy); } }
public void Apply(IClassInstance instance) { var schema = instance.EntityType.Namespace.Split('.').Last(); var typeName = instance.EntityType.Name; var tableName = default(string); instance.Table(tableName); }
/// <summary> /// Apply changes to the target /// </summary> public void Apply(IClassInstance instance) { var proxy = GetProxyType(instance.EntityType); if(proxy != null) { instance.Proxy(proxy); } }
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); } }
/// <summary> /// Apply changes to the target /// </summary> public virtual void Apply(IClassInstance instance) { if(Options.DefaultLazy) instance.LazyLoad(); if(Options.DynamicInsert) instance.DynamicInsert(); if(Options.DynamicUpdate) instance.DynamicUpdate(); }
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); }
private bool IsCacheable( IClassInstance instance ) { var isCacheable = false; if ( typeof( ILookup ).IsAssignableFrom ( instance.EntityType ) || instance.EntityType.IsDefined ( typeof( CacheAttribute ), true ) ) { isCacheable = true; } return isCacheable; }
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("`", ""))); } } }
/// <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) { 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) { 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); }
/// <summary> /// Applies caching for instance. /// </summary> /// <param name="instance">The instance.</param> public void Apply( IClassInstance instance ) { if ( IsCacheable ( instance ) ) { instance.Cache.ReadOnly (); instance.Cache.IncludeAll (); var region = CacheAttributeRegion; if ( typeof( ILookup ).IsAssignableFrom ( instance.EntityType ) ) { region = LookupRegion; } instance.Cache.Region ( region ); } }
public void Apply(IClassInstance instance) { instance.Cache.ReadWrite(); }
public void Apply(IClassInstance instance) { instance.Schema(Schema); instance.Table(instance.EntityType.Name + ConventionConstants.TableSuffix); }
public void Apply(IClassInstance instance) { instance.Table(Inflector.Net.Inflector.Pluralize(instance.EntityType.Name)); }
public void Apply(IClassInstance instance) { var tableName = Inflector.Pluralize(instance.EntityType.Name); instance.Table(tableName); }
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) { instance.Table($"[dbo].[{instance.EntityType.Name}]"); }
public void Apply(IClassInstance instance) { instance.Table(string.Format("`{0}`", Inflector.Pluralize(NamingHelper.GetPrefixedName(instance.EntityType)))); }
public void Apply(IClassInstance instance) { instance.Not.LazyLoad(); }