Пример #1
0
        private bool InitializeSeparateIndex(PropertyInfo property, out IndexGenerator index)
        {
            var indexAttribute = property.GetCustomAttribute <IndexAttribute>(false);

            if (indexAttribute != null)
            {
                index = cacheIndexes.SelectOne(nameof(IndexGenerator.IndexName), indexAttribute.IndexName)
                        ?? new IndexGenerator {
                    Attribute = indexAttribute
                };
                index.Table = this;
                var columnAttribute = GetColumnByProperty(property.Name);
                index.Columns.Add(columnAttribute);
                return(true);
            }
            index = null;
            return(false);
        }
Пример #2
0
        private bool InitializeIndex(PropertyInfo property, IEnumerable <ColumnGenerator> columns, out IndexGenerator index)
        {
            var indexAttribute = property.GetCustomAttribute <IndexAttribute>(false);

            if (indexAttribute != null)
            {
                index = cacheIndexes.SelectOne(nameof(IndexGenerator.IndexName), indexAttribute.IndexName)
                        ?? new IndexGenerator {
                    Attribute = indexAttribute
                };
                index.Table = this;
                index.Columns.AddRange(columns);
                return(true);
            }
            index = null;
            return(false);
        }