protected IsolationAppServer(string serverTypeName, StatusInfoAttribute[] serverStatusMetadata)
 {
     State = ServerState.NotInitialized;
     ServerTypeName = serverTypeName;
     m_ServerStatusMetadata = PrepareStatusMetadata(serverStatusMetadata);
 }
 protected override IWorkItem CreateWorkItemInstance(string serviceTypeName, StatusInfoAttribute[] serverStatusMetadata)
 {
     return new AppDomainAppServer(serviceTypeName, serverStatusMetadata);
 }
        private StatusInfoAttribute[] PrepareStatusMetadata(StatusInfoAttribute[] serverStatusMetadata)
        {
            if (!StatusMetadataExtended)
                return serverStatusMetadata;

            var additionalAttrs = this.GetType()
                            .GetCustomAttributes(typeof(StatusInfoAttribute), true)
                            .OfType<StatusInfoAttribute>()
                            .ToArray();

            if (additionalAttrs.Length == 0)
                return serverStatusMetadata;

            var list = serverStatusMetadata.ToList();
            list.AddRange(additionalAttrs);
            return list.ToArray();
        }
Exemple #4
0
 /// <summary>
 /// 创建AppServer工作项实例
 /// </summary>
 protected virtual IWorkItem CreateWorkItemInstance(string serviceTypeName, StatusInfoAttribute[] serverStatusMetadata)
 {
     var serviceType = Type.GetType(serviceTypeName, true);
     return Activator.CreateInstance(serviceType) as IWorkItem;
 }