本文整理汇总了C#中Machine.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Machine.Save方法的具体用法?C# Machine.Save怎么用?C# Machine.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Machine
的用法示例。
在下文中一共展示了Machine.Save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Install
public Cluster Install(bool system, string clusterName, string username, string email, string password)
{
cluster = new Cluster(Context)
{
Name = clusterName,
System = system,
};
cluster.Save();
// Create machine roles and machines
// -- controller role
var mrcont = new MachineRole(cluster)
{
Name = Constants.ControllerMachineRoleName,
System = system,
MachineRoleType = MachineRoleType.StandAlone,
};
mrcont.Save();
var sv = new ServerVersion(mrcont)
{
Name = Constants.ServerVersionName,
System = system,
};
sv.Save();
var mcont = new Machine(mrcont)
{
Name = Constants.ControllerMachineName,
};
mcont.Save();
var sicont = new ServerInstance(mcont)
{
Name = Constants.ServerInstanceName,
ServerVersion = sv,
};
sicont.Save();
// -- node role
var mrnode = new MachineRole(cluster)
{
Name = Constants.NodeMachineRoleName,
MachineRoleType = MachineRoleType.MirroredSet,
};
mrnode.Save();
var nodesv = new ServerVersion(mrnode)
{
Name = Constants.ServerVersionName,
};
nodesv.Save();
// -- Create a node
/*
Machine mnode = new Machine(Context, mrnode);
mnode.Name = Constants.NodeMachineName;
mnode.Save();
si = new ServerInstance(Context, mnode);
si.Name = Constants.ServerInstanceName;
si.ServerVersionReference.Value = sv;
si.Save();*/
// Create the shared domain for cluster level databases and users
var domain = new Domain(cluster)
{
Name = Constants.SharedDomainName,
Email = email,
System = system,
};
domain.Save();
// Create administrator group and user
GenerateAdminGroup(system);
GenerateAdmin(system, username, email, password);
// Create the shared feredation
var federation = new Federation(domain)
{
Name = Constants.SharedFederationName,
Email = email,
System = system,
ControllerMachine = mcont,
SchemaSourceServerInstance = sicont,
};
federation.Save();
// Temp database definition
var tempdd = new DatabaseDefinition(federation)
{
Name = Constants.TempDbName,
System = system,
LayoutType = DatabaseLayoutType.Monolithic,
DatabaseInstanceNamePattern = Constants.TempDbInstanceNamePattern,
DatabaseNamePattern = Constants.TempDbNamePattern,
SliceCount = 1,
PartitionCount = 1,
};
//.........这里部分代码省略.........
示例2: Install
public void Install(bool system, string clusterName, string username, string email, string password)
{
var cluster = new Cluster(Context)
{
Name = clusterName,
System = system,
};
cluster.Save();
// Create administrator group and user
var ug = new UserGroup(cluster)
{
Name = Constants.ClusterAdministratorUserGroupName,
System = system,
};
ug.Save();
var u = new User(cluster)
{
Name = username,
System = system,
Email = email,
DeploymentState = Registry.DeploymentState.Deployed,
};
u.SetPassword(password);
u.Save();
u.MakeMemberOf(ug.Guid);
// Create machine roles and machines
// -- controller role
var mrcont = new MachineRole(cluster)
{
Name = Constants.ControllerMachineRoleName,
System = system,
MachineRoleType = MachineRoleType.StandAlone,
};
mrcont.Save();
var sv = new ServerVersion(mrcont)
{
Name = Constants.ServerVersionName,
};
sv.Save();
var mcont = new Machine(mrcont)
{
Name = Constants.ControllerMachineName,
};
mcont.Save();
var si = new ServerInstance(mcont)
{
Name = Constants.ServerInstanceName,
ServerVersion = sv,
};
si.Save();
// -- node role
var mrnode = new MachineRole(cluster)
{
Name = Constants.NodeMachineRoleName,
MachineRoleType = MachineRoleType.MirroredSet,
};
mrnode.Save();
sv = new ServerVersion(mrnode)
{
Name = Constants.ServerVersionName,
};
sv.Save();
// -- Create a node
/*
Machine mnode = new Machine(Context, mrnode);
mnode.Name = Constants.NodeMachineName;
mnode.Save();
si = new ServerInstance(Context, mnode);
si.Name = Constants.ServerInstanceName;
si.ServerVersionReference.Value = sv;
si.Save();*/
// Temp database definition
var tempdd = new DatabaseDefinition(cluster)
{
Name = Constants.TempDbName,
System = system,
LayoutType = DatabaseLayoutType.Monolithic,
DatabaseInstanceNamePattern = Constants.TempDbInstanceNamePattern,
DatabaseNamePattern = Constants.TempDbNamePattern,
SliceCount = 1,
PartitionCount = 1,
};
tempdd.Save();
var tempddi = new DatabaseDefinitionInstaller(tempdd);
tempddi.GenerateDefaultChildren(sv, Constants.TempDbName);
//.........这里部分代码省略.........