/// <summary>
        /// Sets table name and table's schema following the rule that the table name is the same as the type name.
        /// </summary>
        /// <remarks>
        /// Exceptions to the rule:
        ///     - "ClientScope" class has to be mapped to the "ClientScopes" table.
        /// </remarks>
        private void BeforeMapConfigurationStoreClass(IModelInspector modelInspector, Type type, IClassAttributesMapper classCustomizer)
        {
            TableDefinition tableDef = null;

            if (type == typeof(ClientScope))
            {
                tableDef = GetTableDefinition(nameof(_options.ClientScopes), _options);
            }
            else
            {
                tableDef = GetTableDefinition(type.Name, _options);
            }

            if (tableDef != null)
            {
                classCustomizer.MapToTable(tableDef, _options);
            }

            // Common mapping rule for IDs
            classCustomizer.Id(map =>
            {
                map.Column("Id");
                map.Generator(Generators.Native);
            });
        }
コード例 #2
0
        private void BeforeMapOperationalStoreClass(IModelInspector modelInspector, Type type, IClassAttributesMapper classCustomizer)
        {
            TableDefinition tableDef;

            if (type == typeof(PersistedGrant))
            {
                tableDef = GetTableDefinition(nameof(_options.PersistedGrants), _options);
            }
            else
            {
                tableDef = GetTableDefinition(type.Name, _options);
            }

            if (tableDef != null)
            {
                classCustomizer.MapToTable(tableDef, _options);
            }

            classCustomizer.DynamicUpdate(true);
        }