@@ -39,13 +39,16 @@ processed by an `Engine` instance. The `DataSourceSet` will reference a
39
39
` DataSourceSet ` are able to be processed.
40
40
41
41
```` cs
42
- using var plugins = PluginSet .Load ();
43
- using var dataSources = DataSourceSet .Create (plugins );
44
-
45
- dataSources .AddDataSource (new FileDataSource (" myfile.txt" ));
46
- dataSources .AddDataSource (new FileDataSource (" yourfile.txt" ));
42
+ using (var plugins = PluginSet .Load ())
43
+ {
44
+ using (var dataSources = DataSourceSet .Create (plugins ))
45
+ {
46
+ dataSources .AddDataSource (new FileDataSource (" myfile.txt" ));
47
+ dataSources .AddDataSource (new FileDataSource (" yourfile.txt" ));
47
48
48
- // ... and so on
49
+ // ... and so on
50
+ }
51
+ }
49
52
50
53
````
51
54
@@ -69,7 +72,7 @@ to pass `false` will be added in a future update.
69
72
```` cs
70
73
using (var plugins1 = PluginSet .Load ())
71
74
{
72
- using (var dataSources = DataSourceSet .Create (plugins , true ))
75
+ using (var dataSources = DataSourceSet .Create (plugins1 , true ))
73
76
{
74
77
}
75
78
@@ -82,9 +85,16 @@ using (var plugins1 = PluginSet.Load())
82
85
In order to use the ` Engine ` , you must first load your plugins and data sources.
83
86
Once you have done so, you may use the ` Create ` method with an ` EngineCreateInfo `
84
87
instance in order to create a useable ` Engine. ` Similar to how the ` DataSourceSet `
85
- can take ownership of the ` PluginSet ` , the ` Engine ` takes ownership of the
86
- ` DataSourceSet ` . Set the ` OwnsDataSources ` property on the ` EngineCreateInfo `
87
- instance to suppress this behavior.
88
+ can take ownership of the ` PluginSet ` , the ` Engine ` can take ownership of
89
+ data sources. The ` Engine ` will take ownership of and safely dispose of any
90
+ ` IDataSource ` instances passed to its static ` Create ` methods. More concretely,
91
+ an ` Engine ` created by calling either
92
+ - ` Create(IDataSource, Type) `
93
+ - ` Create(IEnumerable<IDataSource>, Type) `
94
+
95
+ will take ownership of the data source(s) passed in as the first parameter. ** To
96
+ suppress this behavior, you must use the ` Create(EngineCreateInfo) ` method** .
97
+
88
98
Once your ` Engine ` has been created, you can enable cookers and tables to
89
99
participate in processing. If an attempt is made to enable a cooker for which
90
100
there is no corresponding data source in the ` DataSourceSet ` , then an exception
@@ -108,3 +118,10 @@ using (var dataSources = DataSourceSet.Create(plugins))
108
118
}
109
119
````
110
120
121
+ # Reusing the DataSourceSet - Coming Soon
122
+
123
+ We have plans for the future to enable reusing the `DataSourceSet ` and `PluginSet `
124
+ across `Engine ` instances . However , this functionality has not been fully implemented .
125
+ Thus , at this time , it is not supported to create a new `Engine ` reusing a `DataSourceSet `.
126
+ Once you have finished using an `Engine ` instance , you should dispose the corresponding
127
+ `DataSourceSet ` and `PluginSet `
0 commit comments