private static async Task <ConfigEntity> QueryRabbitPortAsync(IStorageModel store)
        {
            var             find       = new QueryContext("RabbitMQ:Port", QueryTypes.ValueRequest, store);
            OperationResult rabbitPort = await Factory.RunOperationAsync(find);

            return(rabbitPort.Result);
        }
        ///<summary>
        /// Create an InMemory Store that uses Microsoft.Extensions.DependencyInjection for a MemoryStore Instance
        ///</summary>
        public static IServiceCollection AddInMemoryInteraction(this IServiceCollection services)
        {
            services.AddSingleton <IInteract>(config =>
            {
                IStorageModel model         = config.GetRequiredService <IStorageModel>();
                IAuthStorageModel authModel = config.GetRequiredService <IAuthStorageModel>();

                return(new MemoryInteract(model, authModel));
            });
            return(services);
        }
        public CommandContext(CommandTypes types, ConfigChangeRequest changeRequest, IStorageModel model)
            : base(model)
        {
            CommandType = types;
            Check(changeRequest, "changeRequest");
            Check(changeRequest.Name, "changeRequest.Name");
            Check(changeRequest.Value, "changeRequest.Value");

            ChangeRequest         = changeRequest;
            ConfigurationEntryKey = ChangeRequest.Name;
        }
Esempio n. 4
0
        public StorageAreal(IStorageModel s, double elevation)
        {
            _storage         = s;
            _disregardedArea = _storage.StoreGeometry.surfaceAreaForHeight(elevation);

            // Max area and Max elevation correspond to the highest defined point for the storage.
            // Note: At time of writing (02/08/2017) Storages in riversystem are not constrained by the geometry and can actually rise higher than the highes tdefined point.

            MaxArea = _storage.StoreGeometry.surfaceAreaForHeight(_storage.StoreGeometry.MaxHeight()) -
                      _disregardedArea;

            MaxElevation = _storage.StoreGeometry.MaxHeight();
        }
Esempio n. 5
0
        }                                       // null means Query
        public UserContext(AuthModel user, IStorageModel model, CommandTypes?type, IAuthStorageModel authStorage, params ApplicationClaim[] claims)
            : base(model)
        {
            string msg = $"ctor of UserContext for [{type.ToString()}]";

            SanityChecks.CheckNull(model, msg);
            SanityChecks.CheckNull(user, msg);
            SanityChecks.CheckNull(authStorage, msg);

            Type        = type;
            Claims      = claims;
            AuthModel   = user;
            AuthStorage = authStorage;
        }
 public UserController(IStorageModel model, IAuthStorageModel authStore)
 {
     _model            = model;
     _authStorageModel = authStore;
 }
Esempio n. 7
0
 internal static UserDataContext Load(IStorageModel storage)
 {
     UserDataContext result = null;
     try { result = storage.LoadFromStorageAsync<UserDataContext>(ConnectionString).Result; }
     catch (Exception ex) 
     {
         var settings = SettingsModelFactory.GetSettingsModel();
         settings.AddOrUpdate("currentUser", string.Empty);
         settings.SaveSettings();
         result = new UserDataContext(); 
     }
     
     result.UserFavorites.CollectionChanged += UserFavorites_CollectionChanged;
     return result;
 }
 protected ConfigurationContext(IStorageModel model)
 {
     Check(model, "model");
     StorageEngine = model;
 }
 public ConfigurationModel(string name, string value, IStorageModel model)
 {
     _name  = name;
     _model = model;
     _value = value;
 }
 public UploadFileAsync(string json, ITransform transform, IStorageModel model)
 {
     _transform = transform;
     _model     = model;
     _json      = json;
 }
Esempio n. 11
0
 private static ConfigurationContext _Create(CommandTypes cType, IStorageModel model, (string n, string v) tuple)
Esempio n. 12
0
 ///<summary>
 /// Crud.Delete Context
 ///</summary>
 public static ConfigurationContext QueryAll(this IStorageModel model, string _for)
 {
     return(new QueryContext(_for, QueryTypes.AllValues, model));
 }
Esempio n. 13
0
 ///<summary>
 /// Crud.Delete Context
 ///</summary>
 public static ConfigurationContext QueryOne(this IStorageModel model, string _for)
 {
     return(new QueryContext(_for, QueryTypes.ValueRequest, model));
 }
Esempio n. 14
0
 ///<summary>
 /// Crud.Delete Context
 ///</summary>
 public static ConfigurationContext DeleteContext(this IStorageModel model, string _for, string _with = "")
 => _Create(CommandTypes.Delete, model, (_for, _with));
Esempio n. 15
0
 ///<summary>
 /// Crud.Update Context
 ///</summary>
 public static ConfigurationContext UpdateContext(this IStorageModel model, string _for, string _with)
 => _Create(CommandTypes.UpdateValue, model, (_for, _with));
Esempio n. 16
0
 public FakeContext(IStorageModel model)
     : base(model)
 {
 }
Esempio n. 17
0
 public Task SaveAsync(IStorageModel storage)
 {
     return storage.SaveToStorageAsync(string.Format("{0}_pins.dat", this.Username),
         this);
 }
Esempio n. 18
0
 public static async Task<PinnedForumsProfile> LoadAsync(IStorageModel storage, string username)
 {
     PinnedForumsProfile profile = null;
     try
     {
         
         profile = await storage.LoadFromStorageAsync<PinnedForumsProfile>(
             string.Format("{0}_pins.dat", username));
          
     }
     
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
         profile = new PinnedForumsProfile() { Username = username };
     }
     
     return profile;
 }
 public MemoryInteract(IStorageModel model, IAuthStorageModel authStorage)
 {
     _model       = model;
     _authStorage = authStorage;
 }
Esempio n. 20
0
 internal ContextTester(IStorageModel model) : base(model)
 {
 }