-
Notifications
You must be signed in to change notification settings - Fork 247
Commit
…. Just passing config prop holder to the constructor to let the class be smarter about setting itself up
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,20 @@ | ||
namespace roundhouse.infrastructure.app.builders | ||
{ | ||
using System.Collections.Generic; | ||
using filesystem; | ||
using resolvers; | ||
|
||
public class VersionResolverBuilder | ||
{ | ||
public static VersionResolver build(FileSystemAccess file_system, ConfigurationPropertyHolder configuration_property_holder) | ||
{ | ||
VersionResolver xml_version_finder = new XmlFileVersionResolver(file_system, | ||
configuration_property_holder.VersionXPath, | ||
configuration_property_holder.VersionFile); | ||
VersionResolver dll_version_finder = new DllFileVersionResolver(file_system, | ||
configuration_property_holder.VersionFile); | ||
|
||
VersionResolver script_number_version_finder = new ScriptfileVersionResolver(file_system, | ||
configuration_property_holder.VersionFile, | ||
file_system.combine_paths(configuration_property_holder.SqlFilesDirectory, configuration_property_holder.UpFolderName)); | ||
IEnumerable<VersionResolver> resolvers = new List<VersionResolver> {xml_version_finder, dll_version_finder}; | ||
|
||
return new ComplexVersionResolver(resolvers); | ||
} | ||
} | ||
namespace roundhouse.infrastructure.app.builders | ||
{ | ||
using System.Collections.Generic; | ||
using filesystem; | ||
using resolvers; | ||
|
||
public class VersionResolverBuilder | ||
{ | ||
public static VersionResolver build(FileSystemAccess file_system, ConfigurationPropertyHolder configuration_property_holder) | ||
{ | ||
VersionResolver xml_version_finder = new XmlFileVersionResolver(file_system, configuration_property_holder.VersionXPath, configuration_property_holder.VersionFile); | ||
VersionResolver dll_version_finder = new DllFileVersionResolver(file_system, configuration_property_holder.VersionFile); | ||
VersionResolver script_number_version_finder = new ScriptfileVersionResolver(file_system, configuration_property_holder); | ||
|
||
IEnumerable<VersionResolver> resolvers = new List<VersionResolver> { xml_version_finder, dll_version_finder, script_number_version_finder }; | ||
|
||
return new ComplexVersionResolver(resolvers); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,17 +5,19 @@ | |
|
||
namespace roundhouse.resolvers | ||
{ | ||
using infrastructure.app; | ||
|
||
public class ScriptfileVersionResolver : VersionResolver | ||
{ | ||
private string version_file; | ||
private FileSystemAccess file_system; | ||
private string up_folder; | ||
|
||
public ScriptfileVersionResolver (FileSystemAccess file_system, string version_file, string upFolder) | ||
public ScriptfileVersionResolver(FileSystemAccess file_system, ConfigurationPropertyHolder configuration_property_holder) | ||
{ | ||
this.version_file = version_file; | ||
this.file_system = file_system; | ||
this.up_folder = upFolder; | ||
this.version_file = configuration_property_holder.VersionFile; | ||
this.up_folder = file_system.combine_paths(configuration_property_holder.SqlFilesDirectory, configuration_property_holder.UpFolderName); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
ferventcoder
Author
Member
|
||
} | ||
|
||
public bool meets_criteria() | ||
|
Doesn't this overcomplicate the responsibility of this version resolver? Since now you must depend on a full configuration before you can resolve any version.
I realize its 6 or a 1/2 dozen given that this object is used 1 time and that usage always has a configuration object in scope. But given our previous discussion about simplicity and design, this seems counter to that end.
Thoughts?