@@ -24,50 +24,6 @@ namespace FileContextCore
2424 /// </summary>
2525 public static class FileContextDbContextOptionsExtensions
2626 {
27- /// <summary>
28- /// Configures the context to connect to an in-memory database.
29- /// The in-memory database is shared anywhere the same name is used, but only for a given
30- /// service provider. To use the same in-memory database across service providers, call
31- /// <see
32- /// cref="UseFileContextDatabase{TContext}(DbContextOptionsBuilder{TContext},string,FileContextDatabaseRoot,Action{FileContextDbContextOptionsBuilder})" />
33- /// passing a shared <see cref="FileContextDatabaseRoot" /> on which to root the database.
34- /// </summary>
35- /// <typeparam name="TContext"> The type of context being configured. </typeparam>
36- /// <param name="optionsBuilder"> The builder being used to configure the context. </param>
37- /// <param name="databaseName">
38- /// The name of the in-memory database. This allows the scope of the in-memory database to be controlled
39- /// independently of the context. The in-memory database is shared anywhere the same name is used.
40- /// </param>
41- /// <param name="inMemoryOptionsAction">An optional action to allow additional in-memory specific configuration.</param>
42- /// <returns> The options builder so that further configuration can be chained. </returns>
43- public static DbContextOptionsBuilder < TContext > UseFileContextDatabase < TContext > (
44- [ NotNull ] this DbContextOptionsBuilder < TContext > optionsBuilder ,
45- [ NotNull ] string databaseName ,
46- [ CanBeNull ] Action < FileContextDbContextOptionsBuilder > inMemoryOptionsAction = null )
47- where TContext : DbContext
48- => ( DbContextOptionsBuilder < TContext > ) UseFileContextDatabase (
49- ( DbContextOptionsBuilder ) optionsBuilder , databaseName , inMemoryOptionsAction ) ;
50-
51- /// <summary>
52- /// Configures the context to connect to a named in-memory database.
53- /// The in-memory database is shared anywhere the same name is used, but only for a given
54- /// service provider. To use the same in-memory database across service providers, call
55- /// <see cref="UseFileContextDatabase(DbContextOptionsBuilder,string,FileContextDatabaseRoot,Action{FileContextDbContextOptionsBuilder})" />
56- /// passing a shared <see cref="FileContextDatabaseRoot" /> on which to root the database.
57- /// </summary>
58- /// <param name="optionsBuilder"> The builder being used to configure the context. </param>
59- /// <param name="databaseName">
60- /// The name of the in-memory database. This allows the scope of the in-memory database to be controlled
61- /// independently of the context. The in-memory database is shared anywhere the same name is used.
62- /// </param>
63- /// <param name="inMemoryOptionsAction">An optional action to allow additional in-memory specific configuration.</param>
64- /// <returns> The options builder so that further configuration can be chained. </returns>
65- public static DbContextOptionsBuilder UseFileContextDatabase (
66- [ NotNull ] this DbContextOptionsBuilder optionsBuilder ,
67- [ NotNull ] string databaseName ,
68- [ CanBeNull ] Action < FileContextDbContextOptionsBuilder > inMemoryOptionsAction = null )
69- => UseFileContextDatabase ( optionsBuilder , databaseName , null , inMemoryOptionsAction ) ;
70-
7127 /// <summary>
7228 /// Configures the context to connect to an in-memory database.
7329 /// The in-memory database is shared anywhere the same name is used, but only for a given
@@ -79,21 +35,27 @@ public static DbContextOptionsBuilder UseFileContextDatabase(
7935 /// The name of the in-memory database. This allows the scope of the in-memory database to be controlled
8036 /// independently of the context. The in-memory database is shared anywhere the same name is used.
8137 /// </param>
38+ /// <param name="location">An optional parameter to define the location where the files are stored</param>
8239 /// <param name="databaseRoot">
8340 /// All in-memory databases will be rooted in this object, allowing the application
8441 /// to control their lifetime. This is useful when sometimes the context instance
8542 /// is created explicitly with <c>new</c> while at other times it is resolved using dependency injection.
8643 /// </param>
8744 /// <param name="inMemoryOptionsAction">An optional action to allow additional in-memory specific configuration.</param>
45+ /// <param name="serializer">The serializer to be used. Defaults to json</param>
46+ /// <param name="filemanager">The file manager to be used.</param>
8847 /// <returns> The options builder so that further configuration can be chained. </returns>
8948 public static DbContextOptionsBuilder < TContext > UseFileContextDatabase < TContext > (
9049 [ NotNull ] this DbContextOptionsBuilder < TContext > optionsBuilder ,
91- [ NotNull ] string databaseName ,
92- [ CanBeNull ] FileContextDatabaseRoot databaseRoot ,
50+ string serializer = "json" ,
51+ string filemanager = "default" ,
52+ string databaseName = "" ,
53+ string location = null ,
54+ [ CanBeNull ] FileContextDatabaseRoot databaseRoot = null ,
9355 [ CanBeNull ] Action < FileContextDbContextOptionsBuilder > inMemoryOptionsAction = null )
9456 where TContext : DbContext
9557 => ( DbContextOptionsBuilder < TContext > ) UseFileContextDatabase (
96- ( DbContextOptionsBuilder ) optionsBuilder , databaseName , databaseRoot , inMemoryOptionsAction ) ;
58+ ( DbContextOptionsBuilder ) optionsBuilder , serializer , filemanager , databaseName , location , databaseRoot , inMemoryOptionsAction ) ;
9759
9860 /// <summary>
9961 /// Configures the context to connect to a named in-memory database.
@@ -105,26 +67,32 @@ public static DbContextOptionsBuilder<TContext> UseFileContextDatabase<TContext>
10567 /// The name of the in-memory database. This allows the scope of the in-memory database to be controlled
10668 /// independently of the context. The in-memory database is shared anywhere the same name is used.
10769 /// </param>
70+ /// <param name="location">An optional parameter to define the location where the files are stored</param>
10871 /// <param name="databaseRoot">
10972 /// All in-memory databases will be rooted in this object, allowing the application
11073 /// to control their lifetime. This is useful when sometimes the context instance
11174 /// is created explicitly with <c>new</c> while at other times it is resolved using dependency injection.
11275 /// </param>
11376 /// <param name="inMemoryOptionsAction">An optional action to allow additional in-memory specific configuration.</param>
77+ /// <param name="serializer">The serializer to be used. Defaults to json</param>
78+ /// <param name="filemanager">The file manager to be used.</param>
11479 /// <returns> The options builder so that further configuration can be chained. </returns>
11580 public static DbContextOptionsBuilder UseFileContextDatabase (
11681 [ NotNull ] this DbContextOptionsBuilder optionsBuilder ,
117- [ NotNull ] string databaseName ,
118- [ CanBeNull ] FileContextDatabaseRoot databaseRoot ,
82+ string serializer = "json" ,
83+ string filemanager = "default" ,
84+ string databaseName = "" ,
85+ string location = null ,
86+ [ CanBeNull ] FileContextDatabaseRoot databaseRoot = null ,
11987 [ CanBeNull ] Action < FileContextDbContextOptionsBuilder > inMemoryOptionsAction = null )
12088 {
12189 Check . NotNull ( optionsBuilder , nameof ( optionsBuilder ) ) ;
122- Check . NotEmpty ( databaseName , nameof ( databaseName ) ) ;
12390
12491 var extension = optionsBuilder . Options . FindExtension < FileContextOptionsExtension > ( )
12592 ?? new FileContextOptionsExtension ( ) ;
12693
12794 extension = extension . WithStoreName ( databaseName ) ;
95+ extension = extension . WithCustomOptions ( serializer , filemanager , location ) ;
12896
12997 if ( databaseRoot != null )
13098 {
0 commit comments