MicroLite.Mapping.ConventionMappingConvention.CreateObjectInfo C# (CSharp) Méthode

CreateObjectInfo() public méthode

public CreateObjectInfo ( Type forType ) : IObjectInfo
forType System.Type
Résultat IObjectInfo
        public IObjectInfo CreateObjectInfo(Type forType)
        {
            if (forType == null)
            {
                throw new ArgumentNullException("forType");
            }

            var identifierStrategy = this.settings.ResolveIdentifierStrategy(forType);
            var columns = this.CreateColumnInfos(forType, identifierStrategy);

            var tableInfo = new TableInfo(
                columns,
                identifierStrategy,
                this.settings.ResolveTableName(forType),
                this.settings.ResolveTableSchema(forType));

            if (this.log.IsDebug)
            {
                this.log.Debug(LogMessages.MappingConvention_MappingTypeToTable, forType.FullName, tableInfo.Schema, tableInfo.Name);
            }

            return new PocoObjectInfo(forType, tableInfo);
        }

Usage Example

            public void TheTableNameShouldBeUppercasedWithUnderscoresIfMultipleWords()
            {
                var mappingConvention = new ConventionMappingConvention(ConventionMappingSettings.UppercaseWithUnderscores);

                var creditCardObjectInfo = mappingConvention.CreateObjectInfo(typeof(CreditCard));

                Assert.Equal("CREDIT_CARDS", creditCardObjectInfo.TableInfo.Name);
            }
All Usage Examples Of MicroLite.Mapping.ConventionMappingConvention::CreateObjectInfo