Click or drag to resize

ServerFactoryFindByGuid Method

Find a server using his GUID, return null if not found.

Namespace:  AskiaPortalCmn
Assembly:  AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax
public static IServer FindByGuid(
	IContext context,
	Guid guid
)

Parameters

context
Type: AskiaPortalCmnIContext
Context of execution.
guid
Type: SystemGuid
GUID of the server to find.

Return Value

Type: IServer
Return null if the server was not found.
Examples

Find the server using his GUID

var context = ContextFactory.CreateByUserGuid(Guid.Parse("20BE5F84-F006-49A0-9674-4B16A090AF2D"));   
var contextValidation = context.Validate();
if (!contextValidation.Success)
{
    throw contextValidation.Exception;
}
var server = ServerFactory.FindByGuid(context, Guid.Parse("c063513c-06f7-4ae6-80ce-33536df36fe3"));
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