public static T RegisterDefault <T>() where T : DomainBase, new() { if (Default != null) { if (typeof(T) != Default.GetType()) { Default = (new T()).GetInstance("Default"); } } else { Default = (new T()).GetInstance("Default"); } return((T)Default); }
public static TDomain RegisterDefault <TDomain>() where TDomain : DomainBase <TDomain>, new() { if (Default != null) { if (typeof(TDomain) != Default.GetType()) { Default = (new TDomain()).GetInstance("Default"); } } else { Default = (new TDomain()).GetInstance("Default"); } foreach (var asm in DependencyContext .Default .CompileLibraries .SelectMany(cl => cl.ResolveReferencePaths())) { Default.AddReferencesFromDllFile(asm); } return((TDomain)Default); }
public static void Send(IDomainMapper domainMapper, Socket publisher, RuntimeTypeModel typeModel, MemoryStream stream, DomainBase instance) { var status = publisher.SendMore(domainMapper.Type2Bytes(instance.GetType())); if (status != SendStatus.Sent) { throw new InvalidOperationException("Key not sent!"); } stream.SetLength(0); typeModel.Serialize(stream, instance); status = publisher.Send(stream.ToArray()); if (status != SendStatus.Sent) { throw new InvalidOperationException("Instance not sent!"); } }