コード例 #1
0
ファイル: IndexConvention.cs プロジェクト: divyang4481/REM
        /// <summary>
        /// Applies Index based on type.
        /// </summary>
        /// <param name="instance">The instance.</param>
        public void Apply( IPropertyInstance instance )
        {
            CreateUniqeIndexIfIndicated ( instance.Property, instance.Unique, instance.UniqueKey );

            var sourceName = instance.EntityType.Name;
            var propertyName = instance.Property.Name;

            if ( typeof( ILookup ).IsAssignableFrom ( instance.EntityType ) )
            {
                sourceName += "Lkp";
            }

            if ( typeof( ILookup ).IsAssignableFrom ( instance.Property.PropertyType ) )
            {
                propertyName += "Lkp";
            }

            var indexAttribute = instance.Property.MemberInfo.GetCustomAttributes (
                typeof( NaturalIndexAttribute ), false );

            if ( indexAttribute.Length > 0 )
            {
                var indexName = string.Format ( "{0}_{1}_IDX", sourceName, propertyName );
                instance.Index ( indexName );
            }
        }
コード例 #2
0
        /// <summary>
        /// Applies Index based on type.
        /// </summary>
        /// <param name="instance">The instance.</param>
        public void Apply(IPropertyInstance instance)
        {
            CreateUniqeIndexIfIndicated(instance.Property, instance.Unique, instance.UniqueKey);

            var sourceName   = instance.EntityType.Name;
            var propertyName = instance.Property.Name;

            if (typeof(ILookup).IsAssignableFrom(instance.EntityType))
            {
                sourceName += "Lkp";
            }

            if (typeof(ILookup).IsAssignableFrom(instance.Property.PropertyType))
            {
                propertyName += "Lkp";
            }

            var indexAttribute = instance.Property.MemberInfo.GetCustomAttributes(
                typeof(NaturalIndexAttribute), false);

            if (indexAttribute.Length > 0)
            {
                var indexName = string.Format("{0}_{1}_IDX", sourceName, propertyName);
                instance.Index(indexName);
            }
        }
コード例 #3
0
 public void Apply(IPropertyInstance instance)
 {
     if (instance.Property.Name == "Guid" && instance.Property.PropertyType == typeof(Guid))
     {
         instance.Access.ReadOnlyPropertyThroughCamelCaseField(CamelCasePrefix.Underscore);
         instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
     }
 }
コード例 #4
0
ファイル: RootGuidConvention.cs プロジェクト: neozhu/MrCMS
 public void Apply(IPropertyInstance instance)
 {
     if (instance.Property.Name == "Guid" && instance.Property.PropertyType == typeof (Guid))
     {
         instance.Access.ReadOnlyPropertyThroughCamelCaseField(CamelCasePrefix.Underscore);
         instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
     }
 }
コード例 #5
0
 public void Apply(IPropertyInstance instance)
 {
     Entities.BaseEntity e;
     if (instance.Name == nameof(e.InstitutionCode) && instance.Property.PropertyType == typeof(string))
     {
         instance.Index("ind_InstitutionCode");
     }
 }
コード例 #6
0
 public void Apply(IPropertyInstance instance)
 {
     if (!ConfigurationHelper.AppSettingsItem <bool>("SingleTenant"))
     {
         Entities.BaseEntity e;
         if (instance.Name == nameof(e.InstitutionCode) && instance.Property.PropertyType == typeof(string))
         {
             instance.Index("ind_InstitutionCode");
         }
     }
 }
コード例 #7
0
        protected override void Apply(IndexedAttribute attribute, IPropertyInstance instance)
        {
            var name = (attribute.Name ?? instance.Name).ToUpperInvariant();

            if (attribute.Unique)
            {
                instance.UniqueKey($"UNQ_{name}");
            }
            else
            {
                instance.Index($"IDX_{name}");
            }
        }
コード例 #8
0
        public void Apply(IPropertyInstance instance)
        {
            if (instance.Name == "DocumentType")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }

            if (instance.Name == "IsDeleted")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }

            if (instance.Name == "UrlSegment")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }

            if (instance.Name == "BaseUrl")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }

            if (instance.Name == "ParentId")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }

            if (instance.Name == "PublishOn")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }

            if (instance.Name == "DisplayOrder")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }

            if (instance.Name == "SiteId")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }
        }
コード例 #9
0
ファイル: AddIndexConvention.cs プロジェクト: neozhu/MrCMS
        public void Apply(IPropertyInstance instance)
        {
            if (instance.Name == "DocumentType")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }

            if (instance.Name == "IsDeleted")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }

            if (instance.Name == "UrlSegment")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }

            if (instance.Name == "BaseUrl")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }

            if (instance.Name == "ParentId")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }

            if (instance.Name == "PublishOn")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }

            if (instance.Name == "DisplayOrder")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }

            if (instance.Name == "SiteId")
            {
                instance.Index(string.Format("IX_{0}_{1}", instance.EntityType.Name, instance.Property.Name));
            }
        }
コード例 #10
0
 protected override void Apply(IndexAttribute attribute, IPropertyInstance instance)
 {
     instance.Index(attribute.IsKeySet
         ? GetIndexName(instance.EntityType.Name, attribute.KeyName)
         : GetIndexName(instance.EntityType.Name, instance.Name));
 }
コード例 #11
0
 protected override void Apply(IndexableAttribute attribute, IPropertyInstance instance)
 {
     instance.Index(attribute.GetName());
 }
コード例 #12
0
ファイル: IndexAlteration.cs プロジェクト: modulexcite/yessql
 protected override void Apply(IndexedAttribute attribute, IPropertyInstance instance)
 {
     instance.Index("idx__" + instance.Property.Name);
 }