Пример #1
0
        /// <inheritdoc />
        public CachedIotaRestRepository(
            IIotaClient client,
            IPoWService powService,
            IAddressGenerator addressGenerator       = null,
            IDbConnectionSupplier connectionSupplier = null,
            string databaseFilename = "iotacache.sqlite")
            : base(client, powService, addressGenerator)
        {
            this.ConnectionSupplier = connectionSupplier ?? new DefaultDbConnectionSupplier();
            this.ConnectionString   = $"Data Source={databaseFilename};Version=3;";

            DatabaseInitializer.InitCache(this.ConnectionSupplier, databaseFilename);
        }
Пример #2
0
        /// <inheritdoc />
        public CachedIotaRestRepository(
            IRestClient client,
            IPoWService powService = null,
            string username        = null,
            string password        = null,
            IDbConnectionSupplier connectionSupplier = null,
            string databaseFilename = "iotacache.sqlite")
            : base(client, powService, username, password)
        {
            this.ConnectionSupplier = connectionSupplier ?? new DefaultDbConnectionSupplier();
            this.ConnectionString   = $"Data Source={databaseFilename};Version=3;";

            DatabaseInitializer.InitCache(this.ConnectionSupplier, databaseFilename);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="RestIotaRepository"/> class.
        /// </summary>
        /// <param name="client">
        /// The client.
        /// </param>
        /// <param name="powService">
        /// The pow service.
        /// </param>
        /// <param name="username">
        /// The username.
        /// </param>
        /// <param name="password">
        /// The password.
        /// </param>
        public RestIotaRepository(
            IRestClient client,
            IPoWService powService = null,
            string username        = null,
            string password        = null)
        {
            if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
            {
                client.Authenticator = new HttpBasicAuthenticator(username, password);
            }

            this.Client           = new RestIotaClient(client);
            this.PoWService       = powService ?? new RestPoWService(this.Client);
            this.AddressGenerator = new AddressGenerator();
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RestIotaRepository"/> class.
 /// </summary>
 /// <param name="client">
 /// The client.
 /// </param>
 /// <param name="powService">
 /// The pow service.
 /// </param>
 /// <param name="addressGenerator">
 /// The address Generator.
 /// </param>
 public RestIotaRepository(IIotaClient client, IPoWService powService, IAddressGenerator addressGenerator = null)
 {
     this.Client           = client;
     this.PoWService       = powService;
     this.AddressGenerator = addressGenerator ?? new AddressGenerator();
 }