Commit 5583f6af authored by yangxiaodong's avatar yangxiaodong

update options configuration.

parent 9acccdae
...@@ -5,8 +5,7 @@ namespace DotNetCore.CAP ...@@ -5,8 +5,7 @@ namespace DotNetCore.CAP
{ {
public class EFOptions public class EFOptions
{ {
public const string DefaultSchema = "cap"; public const string DefaultSchema = "Cap";
public const string DefaultMigrationsHistoryTableName = "__EFMigrationsHistory";
/// <summary> /// <summary>
/// Gets or sets the schema to use when creating database objects. /// Gets or sets the schema to use when creating database objects.
...@@ -15,17 +14,8 @@ namespace DotNetCore.CAP ...@@ -15,17 +14,8 @@ namespace DotNetCore.CAP
public string Schema { get; set; } = DefaultSchema; public string Schema { get; set; } = DefaultSchema;
/// <summary> /// <summary>
/// Gets or sets the migrations history table's schema. /// EF dbcontext type.
/// If this is null, <see cref="Schema"/> will be used.
/// </summary> /// </summary>
public string MigrationsHistoryTableSchema { get; set; }
/// <summary>
/// Gets or sets the migrations history table's name.
/// Default is <see cref="DefaultMigrationsHistoryTableName"/>.
/// </summary>
public string MigrationsHistoryTableName { get; set; } = DefaultMigrationsHistoryTableName;
public Type DbContextType { get; internal set; } public Type DbContextType { get; internal set; }
} }
} }
\ No newline at end of file
...@@ -40,6 +40,7 @@ namespace Microsoft.Extensions.DependencyInjection ...@@ -40,6 +40,7 @@ namespace Microsoft.Extensions.DependencyInjection
var efOptions = new EFOptions { DbContextType = typeof(TContext) }; var efOptions = new EFOptions { DbContextType = typeof(TContext) };
configure(efOptions); configure(efOptions);
options.RegisterExtension(new SqlServerCapOptionsExtension(configure)); options.RegisterExtension(new SqlServerCapOptionsExtension(configure));
return options; return options;
......
...@@ -6,7 +6,6 @@ using Dapper; ...@@ -6,7 +6,6 @@ using Dapper;
using DotNetCore.CAP.Infrastructure; using DotNetCore.CAP.Infrastructure;
using DotNetCore.CAP.Models; using DotNetCore.CAP.Models;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Options;
namespace DotNetCore.CAP.EntityFrameworkCore namespace DotNetCore.CAP.EntityFrameworkCore
{ {
...@@ -14,9 +13,9 @@ namespace DotNetCore.CAP.EntityFrameworkCore ...@@ -14,9 +13,9 @@ namespace DotNetCore.CAP.EntityFrameworkCore
{ {
private readonly SqlServerOptions _options; private readonly SqlServerOptions _options;
public SqlServerStorageConnection(IOptions<SqlServerOptions> options) public SqlServerStorageConnection(SqlServerOptions options)
{ {
_options = options.Value; _options = options;
} }
public SqlServerOptions Options => _options; public SqlServerOptions Options => _options;
......
...@@ -46,7 +46,7 @@ namespace DotNetCore.CAP.RabbitMQ ...@@ -46,7 +46,7 @@ namespace DotNetCore.CAP.RabbitMQ
_connection = _connectionFactory.CreateConnection(); _connection = _connectionFactory.CreateConnection();
_channel = _connection.CreateModel(); _channel = _connection.CreateModel();
_channel.ExchangeDeclare(exchange: _exchageName, type: _rabbitMQOptions.ExchangeType); _channel.ExchangeDeclare(exchange: _exchageName, type: RabbitMQOptions.ExchangeType);
_channel.QueueDeclare(_queueName, exclusive: false); _channel.QueueDeclare(_queueName, exclusive: false);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment