void GenerateImplementation(StringBuilder src, List <Assembly> references) { CopyAttributes(src); var reentrant = InterleaveAttribute.IsReentrant(actor); if (reentrant) { src.AppendLine($"[global::{typeof(Orleans.Concurrency.ReentrantAttribute).FullName}]"); } var mayInterleave = InterleaveAttribute.MayInterleavePredicate(actor) != null; if (mayInterleave) { src.AppendLine("[MayInterleave(\"MayInterleave\")]"); } string impl = $"Orleankka.Core.ActorEndpoint<I{clazz}>"; if (IsStateful()) { var stateType = GetStateArgument(); var stateTypeFullName = stateType.FullName.Replace("+", "."); impl = $"Orleankka.Core.StatefulActorEndpoint<I{clazz}, global::{stateTypeFullName}>"; references.Add(stateType.Assembly); } src.AppendLine($"public class {clazz} : global::{impl}, I{clazz} {{"); src.AppendLine($"public static bool MayInterleave(InvokeMethodRequest req) => type.MayInterleave(req);"); src.AppendLine("}"); }
internal ActorType(Type @class, ActorInterface @interface, Type grain, string[] conventions) { Class = @class; Interface = @interface; Grain = grain; TypeCode = grain.TypeCode(); Sticky = StickyAttribute.IsApplied(@class); keepAliveTimeout = Sticky ? TimeSpan.FromDays(365 * 10) : KeepAliveAttribute.Timeout(@class); interleavePredicate = InterleaveAttribute.MayInterleavePredicate(@class); invoker = InvokerAttribute.From(@class); dispatcher = new Dispatcher(@class, conventions); dispatchers.Add(@class, dispatcher); Init(grain); }