コード例 #1
0
		public void Apply(IClassInstance instance)
		{
			string tableName = NameConventions.GetTableName(instance.EntityType);

			instance.Table(tableName);
			instance.BatchSize(25);
		}
コード例 #2
0
 public void Apply(IClassInstance instance)
 {
     if (IsCacheable(instance.EntityType))
     {
         instance.Cache.ReadWrite();
     }
 }
コード例 #3
0
 public void Apply(IClassInstance instance)
 {
     if (instance.TableName != null)
     {
         instance.Table(AlterTableName(instance.TableName, "s"));
     }
 }
コード例 #4
0
        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();
                }
            }
        }
コード例 #5
0
        public void Apply(IClassInstance instance)
        {
            var tableName = NameConventions.Quote(NameConventions.GetTableName(instance.EntityType));

            instance.Table(tableName);
            instance.BatchSize(25);
        }
コード例 #6
0
ファイル: SiteFilterConvention.cs プロジェクト: neozhu/MrCMS
 public void Apply(IClassInstance instance)
 {
     if (instance.EntityType.IsSubclassOf(typeof (SiteEntity)))
     {
         instance.ApplyFilter<SiteFilter>();
     }
 }
コード例 #7
0
 /// <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" );
     }
 }
コード例 #8
0
 private void ApplyConventionForSubclasses(IClassInstance instance)
 {
     foreach (var subClassInspector in instance.Subclasses)
     {
         ApplyConventionForSubclasses(instance, subClassInspector);
     }
 }
コード例 #9
0
        public void Apply(IClassInstance instance)
        {
            string entityName = instance.EntityType.Name;
            string tableName  = tablePrefix + entityName;

            instance.Table(tableName);
        }
コード例 #10
0
 public void Apply(IClassInstance instance)
 {
     foreach (var item in instance.References)
     {
         SetManyToOneForeignKey(item, instance);
     }
 }
コード例 #11
0
ファイル: ReadOnlyConvention.cs プロジェクト: divyang4481/REM
 /// <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 ();
     }
 }
コード例 #12
0
        public void Apply(IClassInstance instance)
        {
            string entityTypeName = instance.EntityType.Name;
            string tableName      = entityTypeName.ToUpperInvariant();

            instance.Table(tableName);
        }
コード例 #13
0
 public void Apply(IClassInstance instance)
 {
     RecordBlueprint desc;
     if (_descriptors.TryGetValue(instance.EntityType, out desc)) {
         instance.Table(desc.TableName);
     }
 }
コード例 #14
0
 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>();
 }
コード例 #15
0
 public void Apply(IClassInstance instance)
 {
     var desc = _descriptors.Where(d => d.Type == instance.EntityType).SingleOrDefault();
     if (desc != null) {
         instance.Table(desc.TableName);
     }
 }
コード例 #16
0
        public void Apply(IClassInstance instance)
        {
            instance.Schema("");
            var tableName = NormaliseName(instance.TableName);

            instance.Table(tableName);
        }
コード例 #17
0
        /// <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);
        }
コード例 #18
0
 /// <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");
     }
 }
コード例 #19
0
 public void Apply(IClassInstance instance)
 {
     if (typeof(ISoftDeletable).IsAssignableFrom(instance.EntityType))
     {
         instance.ApplyFilter<SoftDeletableFilter>();
     }
 }
コード例 #20
0
 public void Apply(IClassInstance instance)
 {
     if (instance.TableName != null)
     {
         instance.Table(AlterTableName(instance.TableName, "s"));
     }
 }
コード例 #21
0
 public void Apply(IClassInstance instance)
 {
     entities.Add(instance.EntityType, instance);
     ApplyConventionForReferences(instance);
     ApplyConventionForProperties(instance);
     ApplyConventionForSubclasses(instance);
 }
コード例 #22
0
 public void Apply(IClassInstance instance)
 {
     if (instance.EntityType.IsSubclassOf(typeof(SiteEntity)))
     {
         instance.ApplyFilter <SiteFilter>();
     }
 }
コード例 #23
0
 public void Apply(IClassInstance instance)
 {
     if (typeof(ISoftDeletable).IsAssignableFrom(instance.EntityType))
     {
         instance.ApplyFilter <SoftDeletableFilter>();
     }
 }
コード例 #24
0
        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);
        }
コード例 #25
0
ファイル: ReadOnlyConvention.cs プロジェクト: girish66/REM
 /// <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();
     }
 }
コード例 #26
0
 /// <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));
 }
コード例 #27
0
        /// <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);
        }
コード例 #29
0
 public void Apply(IClassInstance instance)
 {
     Type entityType = instance.EntityType;
     if (IsEcommerceType(entityType))
     {
         instance.Table(GetTableName(instance.TableName));
     }
 }
コード例 #30
0
        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);
        }
コード例 #31
0
        /// <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>();
        }
コード例 #32
0
ファイル: SchemaConvention.cs プロジェクト: divyang4481/REM
        /// <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();
        }
コード例 #34
0
 public void Apply(IClassInstance instance)
 {
     if (instance.TableName.IsNotNull())
     {
         instance.Table(
             string.Format("`{0}_{1}s`", Prefix, instance.TableName.ToLower().Replace("`", ""))
             );
     }
 }
コード例 #35
0
        public void Apply(IClassInstance instance)
        {
            Type entityType = instance.EntityType;

            if (IsEcommerceType(entityType))
            {
                instance.Table(GetTableName(instance.TableName));
            }
        }
コード例 #36
0
        /// <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());
        }
コード例 #37
0
 public void Apply(IClassInstance instance)
 {
     if (typeof(NamedEntity <Guid?>).IsAssignableFrom(instance.EntityType))
     {
         instance.
         Cache.
         NonStrictReadWrite();
     }
 }
コード例 #38
0
        /// <summary>
        /// Apply changes to the target
        /// </summary>
        public void Apply(IClassInstance instance)
        {
            var proxy = GetProxyType(instance.EntityType);

            if (proxy != null)
            {
                instance.Proxy(proxy);
            }
        }
コード例 #39
0
            public void Apply(IClassInstance instance)
            {
                var schema    = instance.EntityType.Namespace.Split('.').Last();
                var typeName  = instance.EntityType.Name;
                var tableName = default(string);


                instance.Table(tableName);
            }
コード例 #40
0
        /// <summary>
        /// Apply changes to the target
        /// </summary>
        public void Apply(IClassInstance instance)
        {
            var proxy = GetProxyType(instance.EntityType);

            if(proxy != null)
            {
                instance.Proxy(proxy);
            }
        }
コード例 #41
0
 public void Apply(IClassInstance instance)
 {
     if (instance.TableName.IsNotNull())
     {
         instance.Table(
             string.Format("`{0}_{1}s`", Prefix, instance.TableName.ToLower().Replace("`", ""))
         );
     }
 }
コード例 #42
0
        public void Apply(IClassInstance instance)
        {
            RecordBlueprint desc;

            if (_descriptors.TryGetValue(instance.EntityType, out desc))
            {
                instance.Table(desc.TableName);
            }
        }
コード例 #43
0
        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);
            }
        }
コード例 #44
0
        /// <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();
        }
コード例 #45
0
        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);
        }
コード例 #46
0
ファイル: CacheConvention.cs プロジェクト: divyang4481/REM
        private bool IsCacheable( IClassInstance instance )
        {
            var isCacheable = false;

            if ( typeof( ILookup ).IsAssignableFrom ( instance.EntityType )
                 || instance.EntityType.IsDefined ( typeof( CacheAttribute ), true ) )
            {
                isCacheable = true;
            }

            return isCacheable;
        }
コード例 #47
0
 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("`", "")));
         }
     }
 }
コード例 #48
0
 /// <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);
     }
 }
コード例 #49
0
        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));
        }
コード例 #50
0
        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);
        }
コード例 #51
0
ファイル: CacheConvention.cs プロジェクト: divyang4481/REM
        /// <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 );
            }
        }
コード例 #52
0
ファイル: CacheConventions.cs プロジェクト: anycall/Orchard
 public void Apply(IClassInstance instance) {
     instance.Cache.ReadWrite();
 }
コード例 #53
0
ファイル: ClassConvention.cs プロジェクト: adamjmoon/Siege
 public void Apply(IClassInstance instance)
 {
     instance.Schema(Schema);
     instance.Table(instance.EntityType.Name + ConventionConstants.TableSuffix);
 }
コード例 #54
0
 public void Apply(IClassInstance instance)
 {
     string entityName = instance.EntityType.Name;
     string tableName = tablePrefix + entityName;
     instance.Table(tableName);
 }
コード例 #55
0
 public void Apply(IClassInstance instance)
 {
     instance.Table(Inflector.Net.Inflector.Pluralize(instance.EntityType.Name));
 }
コード例 #56
0
 public void Apply(IClassInstance instance)
 {
     var tableName = Inflector.Pluralize(instance.EntityType.Name);
     instance.Table(tableName);
 }
コード例 #57
0
ファイル: TableNameConventions.cs プロジェクト: Umaaz/Komodo
 public void Apply(IClassInstance instance)
 {
     //Adding a prefix so we don't get keyword conflicts i.e. 'cast'
     instance.Table("tbl_" + instance.EntityType.Name);
 }
コード例 #58
0
 public void Apply(IClassInstance instance)
 {
     instance.Table($"[dbo].[{instance.EntityType.Name}]");
 }
コード例 #59
0
 public void Apply(IClassInstance instance)
 {
     instance.Table(string.Format("`{0}`",
         Inflector.Pluralize(NamingHelper.GetPrefixedName(instance.EntityType))));
 }
コード例 #60
0
 public void Apply(IClassInstance instance)
 {
     instance.Not.LazyLoad();
 }