ServerFactoryFindById Method |
Find a server using his identifier, return null if not found.
Namespace:
AskiaPortalCmn
Assembly:
AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax public static IServer FindById(
IContext context,
int id
)
Public Shared Function FindById (
context As IContext,
id As Integer
) As IServer
public:
static IServer^ FindById(
IContext^ context,
int id
)
Parameters
- context
- Type: AskiaPortalCmnIContext
Context of execution. - id
- Type: SystemInt32
Id of the server to find.
Return Value
Type:
IServerReturn null if the server was not found.
Examples
Find the server using his id
var context = ContextFactory.CreateByUserGuid(Guid.Parse("20BE5F84-F006-49A0-9674-4B16A090AF2D"));
var contextValidation = context.Validate();
if (!contextValidation.Success)
{
throw contextValidation.Exception;
}
var server = ServerFactory.FindById(context, 2);
if (server != null)
{
Console.WriteLine("Server Id={0} was found: {1}", server.Id, server.Name);
}
else
{
Console.WriteLine("The specified server doesn't exist.");
}
See Also