mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.3 KiB
51 lines
1.3 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using System.Threading.Tasks;
|
|
using Orleans;
|
|
using Orleans.Core;
|
|
using Orleans.Runtime;
|
|
|
|
namespace Squidex.Infrastructure.Orleans
|
|
{
|
|
public abstract class GrainOfString : GrainBase
|
|
{
|
|
public string Key { get; private set; }
|
|
|
|
protected GrainOfString()
|
|
{
|
|
}
|
|
|
|
protected GrainOfString(IGrainIdentity identity, IGrainRuntime runtime)
|
|
: base(identity, runtime)
|
|
{
|
|
}
|
|
|
|
public sealed override Task OnActivateAsync()
|
|
{
|
|
return ActivateAsync(this.GetPrimaryKeyString());
|
|
}
|
|
|
|
public async Task ActivateAsync(string key)
|
|
{
|
|
Key = key;
|
|
|
|
await OnLoadAsync(key);
|
|
await OnActivateAsync(key);
|
|
}
|
|
|
|
protected virtual Task OnLoadAsync(string key)
|
|
{
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
protected virtual Task OnActivateAsync(string key)
|
|
{
|
|
return Task.CompletedTask;
|
|
}
|
|
}
|
|
}
|
|
|