Ejemplo n.º 1
0
        /// <summary>
        /// Creates an instance of a database of type <see cref="RelationalOrleansQueries"/> and Initializes Orleans queries from the database.
        /// Orleans uses only these queries and the variables therein, nothing more.
        /// </summary>
        /// <param name="invariantName">The invariant name of the connector for this database.</param>
        /// <param name="connectionString">The connection string this database should use for database operations.</param>
        /// <param name="grainReferenceConverter"></param>
        internal static async Task <RelationalOrleansQueries> CreateInstance(string invariantName, string connectionString, IGrainReferenceConverter grainReferenceConverter)
        {
            var storage = RelationalStorage.CreateInstance(invariantName, connectionString);

            var queries = await storage.ReadAsync(DbStoredQueries.GetQueriesKey, DbStoredQueries.Converters.GetQueryKeyAndValue, null);

            return(new RelationalOrleansQueries(storage, new DbStoredQueries(queries.ToDictionary(q => q.Key, q => q.Value)), grainReferenceConverter));
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates an instance of a database of type <see cref="IRelationalStorage"/>.
 /// </summary>
 /// <param name="invariantName">The invariant name of the connector for this database.</param>
 /// <param name="connectionString">The connection string this database should use for database operations.</param>
 /// <returns></returns>
 public static IRelationalStorage CreateGenericStorageInstance(string invariantName, string connectionString)
 {
     return(RelationalStorage.CreateInstance(invariantName, connectionString));
 }