本文整理汇总了C#中IServerConnection.CreateCommand方法的典型用法代码示例。如果您正苦于以下问题:C# IServerConnection.CreateCommand方法的具体用法?C# IServerConnection.CreateCommand怎么用?C# IServerConnection.CreateCommand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IServerConnection
的用法示例。
在下文中一共展示了IServerConnection.CreateCommand方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PopulateTestDataStore
protected void PopulateTestDataStore(IServerConnection conn, string fsId, ref FeatureSchema schema, ref ClassDefinition cls)
{
CreateTestDataStore(conn, fsId, ref schema, ref cls);
IInsertFeatures insert = (IInsertFeatures)conn.CreateCommand((int)CommandType.InsertFeature);
insert.ClassName = cls.Name;
insert.FeatureSourceId = fsId;
var feat = new MutableRecord();
var reader = new FixedWKTReader();
//Initialize this record
feat.PutValue("GEOM", new GeometryValue(reader.Read("POINT (0 0)")));
feat.PutValue("NAME", new StringValue("Test1"));
//Attach to command.
insert.RecordToInsert = feat;
var res = insert.Execute();
feat.SetGeometry("GEOM", reader.Read("POINT (0 1)"));
feat.SetString("NAME", "Test2");
res = insert.Execute();
feat.SetGeometry("GEOM", reader.Read("POINT (1 1)"));
feat.SetString("NAME", "Test3");
res = insert.Execute();
feat.SetGeometry("GEOM", reader.Read("POINT (1 0)"));
feat.SetString("NAME", "Test4");
res = insert.Execute();
}
示例2: RuntimeMap
/// <summary>
/// Initializes this instance
/// </summary>
/// <param name="conn"></param>
protected internal RuntimeMap(IServerConnection conn)
{
this.StrictSelection = true;
this.IsDirty = false;
_disableChangeTracking = true;
this.WatermarkUsage = (int)WatermarkUsageType.Viewer;
this.SiteVersion = conn.SiteVersion;
this.SessionId = conn.SessionID;
this.ObjectId = Guid.NewGuid().ToString();
m_changeList = new Dictionary<string, ChangeList>();
_finiteDisplayScales = new double[0];
this.CurrentConnection = conn;
if (Array.IndexOf(conn.Capabilities.SupportedServices, (int)ServiceType.Mapping) >= 0)
{
_mapSvc = (IMappingService)conn.GetService((int)ServiceType.Mapping);
}
if (Array.IndexOf(conn.Capabilities.SupportedCommands, (int)CommandType.GetResourceContents) >= 0)
{
_getRes = (IGetResourceContents)conn.CreateCommand((int)CommandType.GetResourceContents);
}
this.Layers = new RuntimeMapLayerCollection(this);
this.Groups = new RuntimeMapGroupCollection(this);
}
示例3: CreateTestDataStore
protected void CreateTestDataStore(IServerConnection conn, string fsId, ref FeatureSchema schema, ref ClassDefinition cls)
{
schema = new FeatureSchema("Default", "");
cls = new ClassDefinition("Class1", "");
try
{
if (conn.ResourceService.ResourceExists(fsId))
conn.ResourceService.DeleteResource(fsId);
cls.DefaultGeometryPropertyName = "GEOM";
cls.AddProperty(new DataPropertyDefinition("KEY", "")
{
DataType = DataPropertyType.Int32,
IsAutoGenerated = true,
IsReadOnly = true,
IsNullable = false
}, true);
cls.AddProperty(new DataPropertyDefinition("NAME", "")
{
DataType = DataPropertyType.String,
Length = 255,
IsNullable = true,
IsReadOnly = false
});
cls.AddProperty(new GeometricPropertyDefinition("GEOM", "")
{
GeometricTypes = FeatureGeometricType.Point,
SpatialContextAssociation = "Default"
});
schema.AddClass(cls);
ICreateDataStore create = (ICreateDataStore)conn.CreateCommand((int)CommandType.CreateDataStore);
CoordinateSystemDefinitionBase coordSys = conn.CoordinateSystemCatalog.FindCoordSys("LL84");
create.FeatureSourceId = fsId;
create.CoordinateSystemWkt = coordSys.WKT;
create.Name = "Default";
create.ExtentType = OSGeo.MapGuide.ObjectModels.Common.FdoSpatialContextListSpatialContextExtentType.Dynamic;
create.FileName = "Test.sdf";
create.Provider = "OSGeo.SDF";
create.Schema = schema;
create.XYTolerance = 0.001;
create.ZTolerance = 0.001;
create.Execute();
}
catch
{
schema = null;
cls = null;
throw;
}
}