Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class GCCUPCCodeGenerator : IUPCCodeGenerator
- {
- IPersistence _persistence;
- string _gccPrefix;
- public GCCUPCCodeGenerator(IPersistence persistence , string gccPrefix)
- {
- _persistence = persistence;
- }
- services.AddScoped<IPersistence, Persistence>();
- public class UnixConnection : IUnixDataStore
- {
- public UnixConnection(UnixConnectionOption connectionOptions)
- {
- services.AddScoped<IUnixDataStore>(provider => ConfigureUnixConnectionObject());
- IUnixDataStore ConfigureUnixConnectionObject()
- {
- var connectionParam = new UnixConnectionOption
- {
- DBPort = Convert.ToInt32(Configuration["DBPort"]),
- SSHUserName = Configuration["SSHUserName"],
- SSHHostName = Configuration["SSHHostName"],
- SSHPassword = Configuration["SSHPassword"],
- SQLHostName = Configuration["SQLHostName"],
- SQLUserName = Configuration["SQLUserName"],
- SQLPassword = Configuration["SQLPassword"],
- SQLDatabaseName = Configuration["SQLDatabaseName"]
- };
- return new UnixConnection(connectionParam);
- }
- services.AddScoped<IUPCCodeGenerator>(p =>
- {
- // `p` is a scoped instance of `IServiceProvider`, meaning you can pull services from it
- var persistence = p.GetRequiredService<IPersistence>();
- return new GCCUPCCodeGenerator(persistence, "prefix");
- });
Add Comment
Please, Sign In to add comment