Example #1
0
        /// <summary>
        /// Sets the DataCommunicator of the controller to be a <see cref="AzureBlobStorageCommunicator"/> allowing blob storage to be the backing Store
        /// </summary>
        /// <param name="controller">The controller to set the communicator for</param>
        /// <param name="connectionString">The connection string for connecting to Azure Blob storage</param>
        /// <exception cref="System.ArgumentNullException">
        /// if either <paramref name="connectionString"/>, <paramref name="controller"/> is null
        /// </exception>
        /// <returns>The <see cref="AzureBlobStorageCommunicator"/> to pass additional configuration options</returns>
        public static AzureBlobStorageCommunicator UseAzureBlobStorage(this IStoreBackedPropertyController controller, string connectionString)
        {
            Throw.IfNull(() => controller);
            var communicator = new AzureBlobStorageCommunicator(connectionString);

            controller.DataCommunicator = communicator;
            return(communicator);
        }
Example #2
0
 private static Func <JsonSerializerSettings> GetDefaultSettings(IStoreBackedPropertyController controller)
 {
     return(() =>
     {
         var serializerSettings = new JsonSerializerSettings();
         serializerSettings.Converters = serializerSettings.Converters ?? new List <JsonConverter>();
         serializerSettings.Converters.Add(new StoreBackedPropertyJsonConverter(controller));
         return serializerSettings;
     });
 }
Example #3
0
 /// <summary>
 /// When called, all Json that is converted without custom settings will deserialize <see cref="StoreBackedProperty{T}"/>s and pull their data
 /// </summary>
 /// <param name="controller">The controller to use to retrieve data</param>
 public static void AutoBindLoadedJson(this IStoreBackedPropertyController controller)
 {
     JsonConvert.DefaultSettings = GetDefaultSettings(controller);
 }
Example #4
0
 /// <summary>
 /// Registers encoders for many standard types This does not need to be called on <see cref="StoreBackedPropertyController"/>
 /// </summary>
 /// <param name="controller">The controller to register the encoders to</param>
 /// <exception cref="System.ArgumentNullException">if <paramref name="controller"/> is null</exception>
 public static void RegisterDefaultEncoders(this IStoreBackedPropertyController controller)
 {
     Throw.IfNull(() => controller);
     controller.RegisterEncoder(new StringStoreBackedPropertyEncoder());
     controller.RegisterEncoder(new ByteArrayStoreBackedPropertyEncoder());
 }
 /// <summary>
 /// Initializes a new instance of <see cref="StoreBackedPropertyJsonConverter"/> with the controller used for retrieval operations
 /// </summary>
 /// <param name="controller">The controller to use for retrieval operations</param>
 public StoreBackedPropertyJsonConverter(IStoreBackedPropertyController controller)
 {
     this._controller = controller;
 }