本文整理汇总了C#中IWorkItem.Setup方法的典型用法代码示例。如果您正苦于以下问题:C# IWorkItem.Setup方法的具体用法?C# IWorkItem.Setup怎么用?C# IWorkItem.Setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IWorkItem
的用法示例。
在下文中一共展示了IWorkItem.Setup方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Setup
public bool Setup(string serverType, string bootstrapUri, string assemblyImportRoot, IServerConfig config, ProviderFactoryInfo[] factories)
{
m_AssemblyImporter = new AssemblyImport(assemblyImportRoot);
var serviceType = Type.GetType(serverType);
m_AppServer = (IWorkItem)Activator.CreateInstance(serviceType);
var bootstrap = (IBootstrap)Activator.GetObject(typeof(IBootstrap), bootstrapUri);
return m_AppServer.Setup(bootstrap, config, factories);
}
示例2: Setup
public bool Setup(string serverType, string bootstrapUri, string assemblyImportRoot, IServerConfig config, ProviderFactoryInfo[] factories)
{
m_AssemblyImporter = new AssemblyImport(assemblyImportRoot);
var serviceType = Type.GetType(serverType);
m_AppServer = (IWorkItem)Activator.CreateInstance(serviceType);
var bootstrap = (IBootstrap)Activator.GetObject(typeof(IBootstrap), bootstrapUri);
var ret = m_AppServer.Setup(bootstrap, config, factories);
if (ret)
{
m_Log = ((IAppServer)m_AppServer).Logger;
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
}
return ret;
}
示例3: SetupWorkItemInstance
internal virtual bool SetupWorkItemInstance(IWorkItem workItem, WorkItemFactoryInfo factoryInfo)
{
try
{
//Share AppDomain AppServers also share same socket server factory and log factory instances
factoryInfo.SocketServerFactory.ExportFactory.EnsureInstance();
factoryInfo.LogFactory.ExportFactory.EnsureInstance();
}
catch (Exception e)
{
if (m_GlobalLog.IsErrorEnabled)
m_GlobalLog.Error(e);
return false;
}
return workItem.Setup(this, factoryInfo.Config, factoryInfo.ProviderFactories.ToArray());
}
示例4: Start
/// <summary>
/// Starts this server instance.
/// </summary>
/// <returns>
/// return true if start successfull, else false
/// </returns>
public bool Start()
{
try
{
var currentDomain = AppDomain.CurrentDomain;
var marshalServerType = typeof(MarshalAppServer);
var workingDir = Path.Combine(Path.Combine(currentDomain.BaseDirectory, m_WorkingDir), Name);
if (!Directory.Exists(workingDir))
Directory.CreateDirectory(workingDir);
var startupConfigFile = m_Bootstrap.StartupConfigFile;
if (!string.IsNullOrEmpty(startupConfigFile))
{
if (!Path.IsPathRooted(startupConfigFile))
startupConfigFile = Path.Combine(currentDomain.BaseDirectory, startupConfigFile);
}
m_HostDomain = AppDomain.CreateDomain(m_ServerConfig.Name, currentDomain.Evidence, new AppDomainSetup
{
ApplicationName = m_ServerConfig.Name,
ApplicationBase = workingDir,
ConfigurationFile = startupConfigFile
});
var assemblyImportType = typeof(AssemblyImport);
m_HostDomain.CreateInstanceFrom(assemblyImportType.Assembly.CodeBase,
assemblyImportType.FullName,
true,
BindingFlags.CreateInstance,
null,
new object[] { currentDomain.BaseDirectory },
null,
new object[0]);
m_AppServer = (IWorkItem)m_HostDomain.CreateInstanceAndUnwrap(marshalServerType.Assembly.FullName,
marshalServerType.FullName,
true,
BindingFlags.CreateInstance,
null,
new object[] { m_ServiceTypeName },
null,
new object[0]);
if (!m_AppServer.Setup(m_Bootstrap, m_ServerConfig, m_Factories))
throw new Exception("Failed tp setup MarshalAppServer");
}
catch (Exception)
{
if (m_HostDomain != null)
{
AppDomain.Unload(m_HostDomain);
m_HostDomain = null;
}
if (m_AppServer != null)
{
m_AppServer = null;
}
return false;
}
return m_AppServer.Start();
}
示例5: SetupWorkItemInstance
internal override bool SetupWorkItemInstance(IWorkItem workItem, WorkItemFactoryInfo factoryInfo)
{
return workItem.Setup(m_AppDomainBootstrap, factoryInfo.Config, factoryInfo.ProviderFactories.ToArray());
}