Exemple #1
0
        /// <summary>
        /// Returns a new <see cref="IJournal"/>, initialized with the provided <paramref name="actor"/>.
        /// </summary>
        /// <param name="actor">
        /// The actor.
        /// </param>
        /// <returns>
        /// A new <see cref="IJournal"/>, initialized for the provided <paramref name="actor"/>.
        /// </returns>
        public Task <IJournal> Create(IGrain actor)
        {
            var id      = actor.GetIdString();
            var journal = Journal.GetOrAdd(id, _ => new InMemoryJournal());

            return(Task.FromResult <IJournal>(journal));
        }
Exemple #2
0
        /// <summary>
        /// Returns a new <see cref="IJournal"/>, initialized with the provided actor.
        /// </summary>
        /// <param name="actor">
        /// The actor.
        /// </param>
        /// <returns>
        /// A new <see cref="IJournal"/>, initialized with the provided actor.
        /// </returns>
        public async Task <IJournal> Create(IGrain actor)
        {
            var table = Tables.GetOrAdd(
                actor.GetKind(),
                async _ =>
            {
                var t = this.client.GetTableReference(actor.GetKind() + TableNameSuffix);
                await t.CreateIfNotExistsAsync();
                return(t);
            });

            return(new AzureTableJournal(actor.GetIdString(), await table, this.jsonSettings));
        }
        /// <summary>
        /// Returns a new <see cref="IJournal"/>, initialized with the provided actor.
        /// </summary>
        /// <param name="actor">
        /// The actor.
        /// </param>
        /// <returns>
        /// A new <see cref="IJournal"/>, initialized with the provided actor.
        /// </returns>
        public async Task<IJournal> Create(IGrain actor)
        {
            var table = Tables.GetOrAdd(
                actor.GetKind(), 
                async _ =>
                {
                    var t = this.client.GetTableReference(actor.GetKind() + TableNameSuffix);
                    await t.CreateIfNotExistsAsync();
                    return t;
                });

            return new AzureTableJournal(actor.GetIdString(), await table, this.jsonSettings);
        }
 /// <summary>
 /// Returns a new <see cref="IJournal"/>, initialized with the provided <paramref name="actor"/>.
 /// </summary>
 /// <param name="actor">
 /// The actor.
 /// </param>
 /// <returns>
 /// A new <see cref="IJournal"/>, initialized for the provided <paramref name="actor"/>.
 /// </returns>
 public Task<IJournal> Create(IGrain actor)
 {
     var id = actor.GetIdString();
     var journal = Journal.GetOrAdd(id, _ => new InMemoryJournal());
     return Task.FromResult<IJournal>(journal);
 }