本文整理汇总了C#中ServerType类的典型用法代码示例。如果您正苦于以下问题:C# ServerType类的具体用法?C# ServerType怎么用?C# ServerType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerType类属于命名空间,在下文中一共展示了ServerType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendRequest
protected void SendRequest(string rPath, Dict<string, string> rArgs, ServerType rType, Action<WWW> rOnResponse)
{
var url = HttpServerHost + rPath;
useServerType = rType;
WaitingLayer.Show();
this.StartCoroutine(GET(url, rArgs, rOnResponse));
}
示例2: Open
public void Open(string aConnectionString, ServerType serverType)
{
dbCache.ConnectionString = aConnectionString;
dbCache.ServerType = serverType;
switch (serverType)
{
case ServerType.Firebird:
connection = new FbConnection {ConnectionString = aConnectionString};
break;
case ServerType.MsSql:
connection = new SqlConnection { ConnectionString = aConnectionString };
break;
}
connection.Open();
if (serverType==ServerType.Firebird)
using (var transaction = connection.BeginTransaction())
{
DbData.GetFieldValue(connection, transaction,
"select rdb$set_context('USER_SESSION','RPL_SERVICE','1') from rdb$database;");
transaction.Commit();
}
var t = new Thread(LoadData);
t.Start();
}
示例3: CreateReadPreferenceDocument
public static BsonDocument CreateReadPreferenceDocument(ServerType serverType, ReadPreference readPreference)
{
if (readPreference == null)
{
return null;
}
if (serverType != ServerType.ShardRouter)
{
return null;
}
BsonArray tagSets = null;
if (readPreference.TagSets != null && readPreference.TagSets.Any())
{
tagSets = new BsonArray(readPreference.TagSets.Select(ts => new BsonDocument(ts.Tags.Select(t => new BsonElement(t.Name, t.Value)))));
}
else if (readPreference.ReadPreferenceMode == ReadPreferenceMode.Primary || readPreference.ReadPreferenceMode == ReadPreferenceMode.SecondaryPreferred)
{
return null;
}
var readPreferenceString = readPreference.ReadPreferenceMode.ToString();
readPreferenceString = Char.ToLowerInvariant(readPreferenceString[0]) + readPreferenceString.Substring(1);
return new BsonDocument
{
{ "mode", readPreferenceString },
{ "tags", tagSets, tagSets != null }
};
}
示例4: DeploymentParameters
/// <summary>
/// Creates an instance of <see cref="DeploymentParameters"/>.
/// </summary>
/// <param name="applicationPath">Source code location of the target location to be deployed.</param>
/// <param name="serverType">Where to be deployed on.</param>
/// <param name="runtimeFlavor">Flavor of the clr to run against.</param>
/// <param name="runtimeArchitecture">Architecture of the runtime to be used.</param>
public DeploymentParameters(
string applicationPath,
ServerType serverType,
RuntimeFlavor runtimeFlavor,
RuntimeArchitecture runtimeArchitecture)
{
if (string.IsNullOrEmpty(applicationPath))
{
throw new ArgumentException("Value cannot be null.", nameof(applicationPath));
}
if (!Directory.Exists(applicationPath))
{
throw new DirectoryNotFoundException(string.Format("Application path {0} does not exist.", applicationPath));
}
if (runtimeArchitecture == RuntimeArchitecture.x86)
{
throw new NotSupportedException("32 bit compilation is not yet supported. Don't remove the tests, just disable them for now.");
}
ApplicationPath = applicationPath;
ServerType = serverType;
RuntimeFlavor = runtimeFlavor;
EnvironmentVariables.Add(new KeyValuePair<string, string>("ASPNETCORE_DETAILEDERRORS", "true"));
}
示例5: RunSite
private async Task RunSite(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await TestServices.RunSiteTest(
SiteName,
server,
runtimeFlavor,
architecture,
applicationBaseUrl,
async (httpClient, logger, token) =>
{
// ===== English =====
var response = await RetryHelper.RetryRequest(async () =>
{
return await httpClient.GetAsync(string.Empty);
}, logger, token, retryCount: 30);
var responseText = await response.Content.ReadAsStringAsync();
var headingIndex = responseText.IndexOf("<h2>Application uses</h2>");
Assert.True(headingIndex >= 0);
// ===== French =====
response = await RetryHelper.RetryRequest(async () =>
{
return await httpClient.GetAsync("?culture=fr&ui-culture=fr");
}, logger, token, retryCount: 30);
responseText = await response.Content.ReadAsStringAsync();
headingIndex = responseText.IndexOf("<h2>Utilisations d'application</h2>");
Assert.True(headingIndex >= 0);
});
}
示例6: ExistingPage
private async Task ExistingPage(ServerType server, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await TestServices.RunSiteTest(
SiteName,
server,
runtimeFlavor,
architecture,
applicationBaseUrl,
async (httpClient, logger, token) =>
{
var response = await RetryHelper.RetryRequest(async () =>
{
return await httpClient.GetAsync(string.Empty);
}, logger, token, retryCount: 30);
var responseText = await response.Content.ReadAsStringAsync();
logger.LogResponseOnFailedAssert(response, responseText, () =>
{
string expectedText = "Hello World, try /bob to get a 404";
Assert.Equal(expectedText, responseText);
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
});
});
}
示例7: CreateNew
//-----------------------------------------------------------------------------
public SilkroadServer CreateNew(string bind_addr, int bind_port, string module_addr, int module_port, ServerType srvtype, bool blowfish, bool sec_bytes, bool handshake, PacketDispatcher packetProcessor, DelayedPacketDispatcher delayedPacketDispatcher, List<RedirectRule> redirs = null)
{
if (BindExists(bind_addr, bind_port))
{
Global.logmgr.WriteLog(LogLevel.Error, "Server with given bind address already exists [{0}:{1}]", bind_addr, bind_port);
return null;
}
try
{
SilkroadServer ServerItem =
new SilkroadServer(
new IPEndPoint(IPAddress.Parse(bind_addr), bind_port),
new IPEndPoint(IPAddress.Parse(module_addr), module_port),
srvtype,
blowfish,
sec_bytes,
handshake,
packetProcessor,
delayedPacketDispatcher,
redirs
);
m_servers.Add(ServerItem);
ServerItem.Start();
return ServerItem;
}
catch
{
Global.logmgr.WriteLog(LogLevel.Error, "ServerManager failed to start server, SilkroadServer start error");
}
return null;
}
示例8: RunSite
private async Task RunSite(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl)
{
await TestServices.RunSiteTest(
SiteName,
serverType,
runtimeFlavor,
architecture,
applicationBaseUrl,
async (httpClient, logger, token) =>
{
var response = await RetryHelper.RetryRequest(async () =>
{
return await httpClient.GetAsync(string.Empty);
}, logger, token, retryCount: 30);
var responseText = await response.Content.ReadAsStringAsync();
string expectedText =
"Retry Count 42\r\n" +
"Default Ad Block House\r\n" +
"Ad Block Contoso Origin sql-789 Product Code contoso2014\r\n" +
"Ad Block House Origin blob-456 Product Code 123\r\n";
logger.LogResponseOnFailedAssert(response, responseText, () =>
{
Assert.Equal(expectedText, responseText);
});
});
}
示例9: ApplicationSettings
public ApplicationSettings(string connectionString, ServerType serverType, string nameSpace, string assemblyName)
{
ConnectionString = connectionString;
ServerType = serverType;
NameSpace = nameSpace;
AssemblyName = assemblyName;
}
示例10: AssertMappedTypes
private static void AssertMappedTypes(ServerType serverType, DataTypeMapper mapper, Type expectedType, params string[] dataTypes)
{
foreach (string dataType in dataTypes)
{
Assert.AreEqual(expectedType, mapper.MapFromDBType(serverType, dataType, null, null, null));
}
}
示例11: RunSiteTest
public static async Task RunSiteTest(string siteName, ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl,
Func<HttpClient, ILogger, CancellationToken, Task> validator)
{
var logger = new LoggerFactory()
.AddConsole()
.CreateLogger(string.Format("{0}:{1}:{2}:{3}", siteName, serverType, runtimeFlavor, architecture));
using (logger.BeginScope("RunSiteTest"))
{
var deploymentParameters = new DeploymentParameters(GetPathToApplication(siteName), serverType, runtimeFlavor, architecture)
{
ApplicationBaseUriHint = applicationBaseUrl,
SiteName = "HttpTestSite",
};
using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger))
{
var deploymentResult = deployer.Deploy();
var httpClientHandler = new HttpClientHandler();
var httpClient = new HttpClient(httpClientHandler)
{
BaseAddress = new Uri(deploymentResult.ApplicationBaseUri),
Timeout = TimeSpan.FromSeconds(10)
};
await validator(httpClient, logger, deploymentResult.HostShutdownToken);
}
}
}
示例12: GetVersionHint
internal static string GetVersionHint(SqlVersion version, ServerType serverType)
{
if (serverType == ServerType.Cloud)
{
Debug.Assert(version >= SqlVersion.Sql11);
return SqlProviderManifest.TokenAzure11;
}
switch (version)
{
case SqlVersion.Sql8:
return SqlProviderManifest.TokenSql8;
case SqlVersion.Sql9:
return SqlProviderManifest.TokenSql9;
case SqlVersion.Sql10:
return SqlProviderManifest.TokenSql10;
case SqlVersion.Sql11:
return SqlProviderManifest.TokenSql11;
default:
throw new ArgumentException(Strings.UnableToDetermineStoreVersion);
}
}
示例13: GetReader
public static IMetadataReader GetReader(ServerType serverType, string connectionStr)
{
IMetadataReader metadataReader;
switch(serverType)
{
case ServerType.Oracle:
metadataReader = new OracleMetadataReader(connectionStr);
break;
case ServerType.SqlServer:
metadataReader = new SqlServerMetadataReader(connectionStr);
break;
case ServerType.SqlCe:
metadataReader = new SqlCeMetadataReader(connectionStr);
break;
default:
metadataReader = new OracleMetadataReader(connectionStr);
break;
}
/*if (serverType == ServerType.Oracle)
{
}
else
{
}*/
return metadataReader;
}
示例14: MessageEventArgs
public MessageEventArgs(MessageType messtype, ServerType servertype, String arguments, String message)
{
messagetype = messtype;
type = servertype;
args = arguments;
Message = message;
}
示例15: CreateReadPreferenceDocument
public static BsonDocument CreateReadPreferenceDocument(ServerType serverType, ReadPreference readPreference)
{
if (serverType != ServerType.ShardRouter || readPreference == null)
{
return null;
}
BsonArray tagSets = null;
if (readPreference.TagSets != null && readPreference.TagSets.Count > 0)
{
tagSets = new BsonArray(readPreference.TagSets.Select(ts => new BsonDocument(ts.Tags.Select(t => new BsonElement(t.Name, t.Value)))));
}
// simple ReadPreferences of Primary and SecondaryPreferred are encoded in the slaveOk bit
if (readPreference.ReadPreferenceMode == ReadPreferenceMode.Primary || readPreference.ReadPreferenceMode == ReadPreferenceMode.SecondaryPreferred)
{
if (tagSets == null && !readPreference.MaxStaleness.HasValue)
{
return null;
}
}
var modeString = readPreference.ReadPreferenceMode.ToString();
modeString = Char.ToLowerInvariant(modeString[0]) + modeString.Substring(1);
return new BsonDocument
{
{ "mode", modeString },
{ "tags", tagSets, tagSets != null },
{ "maxStalenessSeconds", () => (int)readPreference.MaxStaleness.Value.TotalSeconds, readPreference.MaxStaleness.HasValue }
};
}