public virtual void InitializeType(Type type) { var typeName = type.Name; if (cachedTypes.Contains(type)) { return; } var properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly); foreach (var property in properties) { var columns = InitializeColumn(property).ToArray(); if (columns.Length > 0) { foreach (var column in columns) { var exist = GetColumnByProperty(column.PropertyName); if (exist != null) { cacheColumns.Remove(exist); } if ((column.Attribute.Keys & DBColumnKeys.ItemType) == DBColumnKeys.ItemType) { cacheColumns.Insert(0, column); } else if ((column.Attribute.Keys & DBColumnKeys.Primary) == DBColumnKeys.Primary) { cacheColumns.Insert(1, column); } else { cacheColumns.Add(column); } } if (InitializeIndex(property, columns, out var index)) { cacheIndexes.Add(index); } } else if (InitializeSeparateIndex(property, out var separateIndex)) { cacheIndexes.Add(separateIndex); } InitializeDefault(property); InitializeParameters(property); } foreach (var property in properties) { if (InitializeReference(property, out var reference)) { cacheReferences.Add(reference); } else if (InitializeReferencing(property, out var referencing)) { cacheReferencings.Add(referencing); } } var methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly); foreach (var method in methods) { InitializeParameters(method); } cachedTypes.Add(type); }