Ejemplo n.º 1
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 );
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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));
     }
 }
Ejemplo n.º 4
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));
     }
 }
Ejemplo n.º 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");
     }
 }
Ejemplo n.º 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");
         }
     }
 }
Ejemplo n.º 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}");
            }
        }
Ejemplo n.º 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));
            }
        }
Ejemplo n.º 9
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));
            }
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 11
0
 protected override void Apply(IndexableAttribute attribute, IPropertyInstance instance)
 {
     instance.Index(attribute.GetName());
 }
Ejemplo n.º 12
0
 protected override void Apply(IndexedAttribute attribute, IPropertyInstance instance)
 {
     instance.Index("idx__" + instance.Property.Name);
 }