当前位置: 首页>>代码示例>>C#>>正文


C# Entity.AddProperty方法代码示例

本文整理汇总了C#中System.Entity.AddProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Entity.AddProperty方法的具体用法?C# Entity.AddProperty怎么用?C# Entity.AddProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Entity的用法示例。


在下文中一共展示了Entity.AddProperty方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetEntitiesEnumerator

        public override IEnumerable<Entity> GetEntitiesEnumerator(OnContinueExceptionCallback exceptionNotifier, DataLoaderParams Params)
        {
            int count = 0;
            string initialTimePrefix = GetSecondsFrom2000Prefix();

            do
            {
                bool isExceptionOccured = false;
                var entity = new Entity();

                try
                {
                    for (int i = 0; i < _dataReader.FieldCount; ++i)
                    {
                        entity.AddProperty(_dataReader.GetName(i), _dataReader[i]);
                    }

                    var placemark = _kml.Descendants().Where(e => e.Name.LocalName == DataLoaderConstants.ElemNamePlacemark).
                                                    Where(e => e.Element(e.Name.Namespace + _params.MatchElementName) != null).
                                                    Where(e => e.Element(e.Name.Namespace + _params.MatchElementName)
                                                        .Value.Contains(_dataReader[_params.MatchPropertyName].ToString()))
                                                        .FirstOrDefault();
                    if (placemark != null)
                    {
                        placemark = new XElement(placemark);

                        foreach (string name in _params.KmlElementsToStrip)
                        {
                            if (string.IsNullOrEmpty(name)) continue;
                            placemark.Element(string.Concat(placemark.Name.Namespace, name)).Remove();
                        }

                        placemark.Element(placemark.Name.Namespace + DataLoaderConstants.ElemNameDescription).SetValue(entity.Id);

                        var p = placemark.ToString(SaveOptions.DisableFormatting)
                                                .Replace(DataLoaderConstants.NsKmlOld, DataLoaderConstants.NsKmlNew);

                        entity.AddProperty(DataLoaderConstants.PropNameKmlSnippet, p);
                    }
                    if (_sourceOrder)
                    {
                        entity.SetNumber(count, initialTimePrefix);
                    }
                }
                catch (Exception ex)
                {
                    exceptionNotifier(new EntityProcessingException(entity.ToString(), ex));
                    isExceptionOccured = true;
                }

                if (!isExceptionOccured)
                {
                    yield return entity;
                    count++;
                }
            }
            while (_dataReader.Read());
        }
开发者ID:aytacozkan,项目名称:OGDI-DataLab,代码行数:58,代码来源:DbaseKmlEntityProducer.cs

示例2: SetUp

        public void SetUp()
        {
            mainPanel = MockRepository.GenerateStub<IMainPanel>();
            form = MockRepository.GenerateMock<IEntityForm>();
            ms = MockRepository.GenerateStub<MappingSet>();

            Property property = new PropertyImpl("Prop1");
            EntityKey key = new EntityKeyImpl();
            entity = new EntityImpl("Entity1") { Key = key };
            entity.AddProperty(property);
            key.AddProperty(property);

            mapping = new MappingImpl();
            form.Stub(f => f.Mappings).Return(new List<Mapping> { mapping });

            EntitySet es = new EntitySetImpl();
            es.AddEntity(entity);
            ms.EntitySet = es;
            es.MappingSet = ms;
            ms.Stub(m => m.GetMappingsContaining(entity)).Return(new List<Mapping>());

            var presenter = new EntityPresenter(mainPanel, form);
            presenter.AttachToModel(entity);
        }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:24,代码来源:Specs_For_EntityPresenter.cs

示例3: GetEntitiesEnumerator

        public override IEnumerable<Entity> GetEntitiesEnumerator(OnContinueExceptionCallback exceptionNotifier, DataLoaderParams Params)
        {
            int count = 0;
            string initialTimePrefix = GetSecondsFrom2000Prefix();
            var properties = _params.PropertyToTypeMap.GetProperties().ToDictionary(c => c.Key.ToLower(), c => c.Value);
            string[] headers = _csvReader.GetFieldHeaders();
            bool isInlineKmlSnippetProvided = false;
            #region RDF
            string entitySet = SchemaEntity["EntitySet"].ToString();

            // rdf get the columns namespaces
            List<TableColumnsMetadataEntity> columnMetadata = TableDataLoader.GetRdfMetadataColumnNamespace(entitySet);
            List<string> namespacesRdf = new List<string>();
            List<string> validNamespaces = new List<string>();

            string namespaceToAdd = string.Empty;
            if (columnMetadata != null)
            {
                foreach (TableColumnsMetadataEntity columnMeta in columnMetadata)
                {
                    if (!string.IsNullOrEmpty(columnMeta.columnnamespace))
                    {
                        namespaceToAdd = columnMeta.columnnamespace.Split('=')[0] + '=';

                        if (namespaceToAdd.Split('=')[0] != string.Empty)
                        {
                            if (!validNamespaces.Contains(namespaceToAdd))
                            {
                                namespacesRdf.Add(columnMeta.columnnamespace);
                                validNamespaces.Add(namespaceToAdd);
                            }
                        }
                    }
                }
            }
            #endregion

            while (_csvReader.ReadNextRecord())
            {
                var entity = new Entity();
                bool isExceptionOccured = false;

                #region RDF

                XNamespace rdfNamespace = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";

                XElement rdfXml = new XElement(rdfNamespace + "RDF",
                new XAttribute(XNamespace.Xmlns + "rdf", rdfNamespace.ToString()));

                // add new namespaces to the rdf snippet if they exist
                if (namespacesRdf != null)
                {
                    foreach (string ns in namespacesRdf)
                    {
                        if (!string.IsNullOrEmpty(ns))
                        {
                            rdfXml.Add(new XAttribute(XNamespace.Xmlns + ns.ToString().Split('=')[0], ns.ToString().Split('=')[1]));
                        }
                    }
                }

                XElement rdfXmlDescriptionElement = new XElement(rdfNamespace + "Description");
                rdfXml.Add(rdfXmlDescriptionElement);
                #endregion

                try
                {
                    for (int i = 0; i < _csvReader.FieldCount; ++i)
                    {
                        if (_csvReader[i] == null)
                            continue;

                        if (_csvReader[i].GetType() == typeof(DBNull))
                            continue;

                        var header = headers[i];

                        if (!isInlineKmlSnippetProvided)
                            isInlineKmlSnippetProvided = header.Equals(DataLoaderConstants.PropNameKmlSnippet,
                                                                       StringComparison.InvariantCultureIgnoreCase);

                        try
                        {
                            if (!properties.ContainsKey(header.ToLower()))
                                throw new ApplicationException("The row data is mismached with column definitions in data file.");

                            var stringType = properties[header.ToLower()];
                            var stringValue = _csvReader[i];

                            if (string.IsNullOrEmpty(stringValue))
                                continue;

                            var v = GetPropertyValue(stringType, stringValue);
                            entity.AddProperty(header, v);

                            #region RDF

                            if (header == Params.ProcessorParams.PartitionKeyPropertyName)
                            {
                                rdfXmlDescriptionElement.Add(new XAttribute(rdfNamespace + "about", stringValue));
//.........这里部分代码省略.........
开发者ID:aytacozkan,项目名称:OGDI-DataLab,代码行数:101,代码来源:CsvEntityProducer.cs

示例4: GetSchemaEntity

        private static Entity GetSchemaEntity(string entitySet, string entityKind, PropertyToTypeMapper mapper)
        {
            var entity = new Entity();
            entity.AddProperty(DataLoaderConstants.PropNameEntitySet, entitySet);
            entity.AddProperty(DataLoaderConstants.PropNameEntityKind, entityKind);

            foreach (var p in mapper.GetProperties())
            {
                entity.AddProperty(p.Key, GetPropertyType(p.Value));
            }

            return entity;
        }
开发者ID:aytacozkan,项目名称:OGDI-DataLab,代码行数:13,代码来源:CsvEntityProducer.cs

示例5: GetSchemaEntity

        public static Entity GetSchemaEntity(TableColumnsMetadataItem mapper)
        {
            var entity = new Entity();
            entity.AddProperty(DataLoaderConstants.TableColumnsMetadataEntitySet, mapper.EntitySet);
            entity.AddProperty(DataLoaderConstants.TableColumnsMetadataColumn, mapper.Column);
            entity.AddProperty(DataLoaderConstants.TableColumnsMetadataColumnSemantic, mapper.ColumnSemantic);
            entity.AddProperty(DataLoaderConstants.TableColumnsMetadataColumnNamespace, mapper.ColumnNamespace);
            entity.AddProperty(DataLoaderConstants.TableColumnsMetadataColumnDescription, mapper.ColumnDescription);

            return entity;
        }
开发者ID:aytacozkan,项目名称:OGDI-DataLab,代码行数:11,代码来源:TableColumnsMetadata.cs

示例6: CreateProperty

        private Property CreateProperty(Entity newEntity, Mapping mapping, string typeName, string propertyName, string columnName, string length)
        {
            Property idProperty = new PropertyImpl(propertyName);

            if (typeName != null)
            {
                if (typeName.IndexOf(",") > 0)
                    idProperty.Type = typeName.Substring(0, typeName.IndexOf(","));
                else
                {
                    if (NHibernateTypeNames.Contains(typeName))
                        idProperty.NHibernateType = typeName;
                    else
                        idProperty.Type = typeName;
                }
            }

            idProperty.ValidationOptions.MaximumLength = length.As<int>();

            newEntity.AddProperty(idProperty);

            if (mapping != null)
            {
                var column = mapping.FromTable.GetColumn(columnName.UnBackTick());

                if (column == null)
                {
                    // Create the column
                    column = entityProcessor.CreateColumn(idProperty);
                    mapping.FromTable.AddColumn(column);
                }
                mapping.AddPropertyAndColumn(idProperty, column);
            }
            return idProperty;
        }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:35,代码来源:EntityLoader.cs

示例7: StartEntCreation

        // Helper method for init()  -> Creates defaultViewport entitys (XYZ plane etc)
        private void StartEntCreation()
        {
            Entity ThreeDReference = new Entity("XYZ Planes");
            ThreeDReference.AddProperty<GraphicsDevice>("GraphicsDevice", GraphicsDevice);
            ThreeDReference.AddProperty<Vector3>("Position", new Vector3(0, 0, 0));
            ThreeDReference.AddProperty<Vector3>("Scale", new Vector3(1));
            ThreeDReference.AddProperty<Vector3>("Rotation", new Vector3(0, 0, 0));
            ThreeDReference.AddProperty<Plane>("PlaneZX", new Plane(Vector3.Up,0f));
            ThreeDReference.AddProperty<Plane>("PlaneYX", new Plane(Vector3.Transform(Vector3.Backward,Matrix.CreateRotationZ(MathHelper.PiOver2)),0f));
            ThreeDReference.AddProperty<Plane>("PlaneYZ", new Plane(Vector3.Transform(Vector3.Right, Matrix.CreateRotationX(MathHelper.PiOver2)), 0f));

            ThreeDReference.AddBehaviour(new RefPlane(50, Matrix.Identity, Color.DarkGreen));
            ThreeDReference.AddBehaviour(new RefPlane(50, Matrix.CreateRotationZ(MathHelper.PiOver2), Color.DarkRed));
            ThreeDReference.AddBehaviour(new RefPlane(50, Matrix.CreateRotationX(MathHelper.PiOver2), Color.OliveDrab));

            BigOlEntityList.Add(ThreeDReference);

            Entity TestEnt = new Entity("VertexCrate");

            TestEnt.AddProperty<Vector3>("Position", new Vector3(0, 0, 0));
            TestEnt.AddProperty<Vector3>("Scale", new Vector3(2, 2, 2));
            TestEnt.AddProperty<Vector3>("Rotation", new Vector3(0, 0, 0));
            TestEnt.AddProperty<BoundingBox>("BoundingBox", new BoundingBox());
            TestEnt.AddProperty<Texture2D>("FrontTex", testTextureII);
            TestEnt.AddProperty<Texture2D>("BackTex", testTextureII);
            TestEnt.AddProperty<Texture2D>("RightTex", testTextureII);
            TestEnt.AddProperty<Texture2D>("LeftTex", testTextureII);
            TestEnt.AddProperty<Texture2D>("TopTex", testTexture);
            TestEnt.AddProperty<Texture2D>("BottomTex", testTexture);
            TestEnt.AddProperty<GraphicsDevice>("GraphicsDevice", GraphicsDevice);
            TestEnt.AddProperty<ContentManager>("Content", Content);
            TestEnt.AddBehaviour(new Brush_Cube());
            TestEnt.AddBehaviour(new SimpleCollide());
            BigOlEntityList.Add(TestEnt);

            Entity TestEntII = new Entity("VertexCrateII");

            TestEntII.AddProperty<Vector3>("Position", new Vector3(0, 2, 0));
            TestEntII.AddProperty<Vector3>("Scale", new Vector3(2, 2, 2));
            TestEntII.AddProperty<Vector3>("Rotation", new Vector3(0, 0, 0));
            TestEntII.AddProperty<BoundingBox>("BoundingBox", new BoundingBox());
            TestEntII.AddProperty<Texture2D>("FrontTex", testTextureII);
            TestEntII.AddProperty<Texture2D>("BackTex", testTextureII);
            TestEntII.AddProperty<Texture2D>("RightTex", testTextureII);
            TestEntII.AddProperty<Texture2D>("LeftTex", testTextureII);
            TestEntII.AddProperty<Texture2D>("TopTex", testTexture);
            TestEntII.AddProperty<Texture2D>("BottomTex", testTexture);
            TestEntII.AddProperty<GraphicsDevice>("GraphicsDevice", GraphicsDevice);
            TestEntII.AddProperty<ContentManager>("Content", Content);
            TestEntII.AddBehaviour(new Brush_Cube());
            TestEntII.AddBehaviour(new SimpleCollide());
            BigOlEntityList.Add(TestEntII);

            Entity TestEntIII = new Entity("VertexCrateIII");

            TestEntIII.AddProperty<Vector3>("Position", new Vector3(0, 0, 5));
            TestEntIII.AddProperty<Vector3>("Scale", new Vector3(2, 2, 2));
            TestEntIII.AddProperty<Vector3>("Rotation", new Vector3(0, 0, 0));
            TestEntIII.AddProperty<BoundingBox>("BoundingBox", new BoundingBox());
            TestEntIII.AddProperty<Texture2D>("FrontTex", testTextureII);
            TestEntIII.AddProperty<Texture2D>("BackTex", testTextureII);
            TestEntIII.AddProperty<Texture2D>("RightTex", testTextureII);
            TestEntIII.AddProperty<Texture2D>("LeftTex", testTextureII);
            TestEntIII.AddProperty<Texture2D>("TopTex", testTexture);
            TestEntIII.AddProperty<Texture2D>("BottomTex", testTexture);
            TestEntIII.AddProperty<GraphicsDevice>("GraphicsDevice", GraphicsDevice);
            TestEntIII.AddProperty<ContentManager>("Content", Content);
            TestEntIII.AddBehaviour(new Brush_Cube());
            TestEntIII.AddBehaviour(new SimpleCollide());
            BigOlEntityList.Add(TestEntIII);
        }
开发者ID:Chronojam,项目名称:Tangle,代码行数:72,代码来源:GameControl.cs

示例8: RemoveChild

        public void RemoveChild(Entity entity)
        {
            if (!children.Contains(entity))
                return;

            children.Remove(entity);
            entity.Parent = null;

            // Add the ID property back to the child entity
            for (int i = entity.Key.Properties.ToList().Count - 1; i >= 0; i--)
            {
                if (entity.Properties.Count(p => p == entity.Key.Properties.ElementAt(i)) == 0)
                    entity.AddProperty(entity.Key.Properties.ElementAt(i));
            }
            // Add any hidden properties back to the child
            foreach (var hiddenProperty in entity.PropertiesHiddenByAbstractParent)
                hiddenProperty.IsHiddenByAbstractParent = false;

            foreach (var hiddenProperty in entity.PropertiesInHiddenKey)
                hiddenProperty.IsPartOfHiddenKey = false;

            // Add references back between removed child and its parent, which was removed when creating the inheritance structure.
            if (entity.MappedTables().Count() > 0 && this.MappedTables().Count() > 0 &&
                entity.DirectedReferences.Count(d => d.ToEntity == this) == 0)
            {
                var thisTable = this.MappedTables().ElementAt(0);
                var childTable = entity.MappedTables().ElementAt(0);

                foreach (Relationship rel in thisTable.Relationships.Where(r => (r.ForeignTable == thisTable && r.PrimaryTable == childTable) || (r.ForeignTable == childTable && r.PrimaryTable == thisTable)))
                    ArchAngel.Providers.EntityModel.Controller.MappingLayer.MappingProcessor.ProcessRelationshipInternal(entity.EntitySet.MappingSet, rel, new ArchAngel.Providers.EntityModel.Controller.MappingLayer.OneToOneEntityProcessor());
            }
            ChildrenChanged.RaiseDeletionEventEx(this, entity);
        }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:33,代码来源:Entity.cs

示例9: Follower

 public Follower(Entity ent, String name)
     : base(ent, name)
 {
     XNAGame.Instance.GetBroadphase<Broadphases.Input>("Input").KeyPressed += new Broadphases.KeyEventHandler(Follower_KeyPressed);
     m_Position = ent.AddProperty<Microsoft.Xna.Framework.Vector3>("Position", Microsoft.Xna.Framework.Vector3.Zero);
 }
开发者ID:Quantumplation,项目名称:Kannon,代码行数:6,代码来源:Follower.cs

示例10: GetNewEntity

        // Helper method for OnSelected -> gets new entity data from the tabcontrol and stores inside a new entity,
        // that is then sent to the gamecontrol for
        // final processing + rendering
        private void GetNewEntity()
        {
            bool allValuesSetAndReal = false;
            foreach (TextBox textbox in numericControls)
            {
                allValuesSetAndReal = CheckForNumeric(textbox);
            }

            if (allValuesSetAndReal)
                if (enableGeoPlacement == true && tabState == TabState.GeometeryTab)
                {
                    Texture2D defaultTexture = gameControl1.DefaultTexture;

                    Entity newGeoEnt = new Entity(geoNameBox.Text);
                    newGeoEnt.AddProperty<Vector3>("Position", gameControl1.GetNewEntFinalPosition());
                    newGeoEnt.AddProperty<GraphicsDevice>("GraphicsDevice", gameControl1.GraphicsDevice);
                    newGeoEnt.AddProperty<ContentManager>("Content", gameControl1.ContentManager);
                    newGeoEnt.AddProperty<Vector3>("Scale", new Vector3(float.Parse(scaleXBox.Text), float.Parse(scaleYBox.Text), float.Parse(scaleZBox.Text)));
                    newGeoEnt.AddProperty<Vector3>("Rotation", new Vector3(float.Parse(geoRotBoxX.Text), float.Parse(geoRotBoxY.Text), float.Parse(geoRotBoxZ.Text)));

                    if (checkBox1.Checked)
                    {
                        newGeoEnt.AddProperty<BoundingBox>("BoundingBox", new BoundingBox());
                        newGeoEnt.AddBehaviour(new SimpleCollide());
                    }

                    if (geoType == Geometrytype.Rectangle)
                    {
                        newGeoEnt.AddProperty<Texture2D>("FrontTex", defaultTexture);
                        newGeoEnt.AddProperty<Texture2D>("BackTex", defaultTexture);
                        newGeoEnt.AddProperty<Texture2D>("RightTex", defaultTexture);
                        newGeoEnt.AddProperty<Texture2D>("LeftTex", defaultTexture);
                        newGeoEnt.AddProperty<Texture2D>("TopTex", defaultTexture);
                        newGeoEnt.AddProperty<Texture2D>("BottomTex", defaultTexture);
                        newGeoEnt.AddBehaviour(new Brush_Cube());
                    }
                    if (geoType == Geometrytype.Sphere)
                    {
                        throw new NotImplementedException();
                    }
                    gameControl1.AddEntToList(newGeoEnt);
                    newGeoEnt = null;
                }
                else
                    throw new DivideByZeroException("Something has gone horribly wrong!");
        }
开发者ID:Chronojam,项目名称:Tangle,代码行数:49,代码来源:Main.cs

示例11: GetSchemaEntity

        private static Entity GetSchemaEntity(DbDataReader reader, string entitySet, string entityKind)
        {
            reader.Read();

            var entity = new Entity();
            entity.AddProperty(DataLoaderConstants.PropNameEntitySet, entitySet);
            entity.AddProperty(DataLoaderConstants.PropNameEntityKind, entityKind);
            for (int i = 0; i < reader.FieldCount; ++i)
            {
                entity.AddProperty(reader.GetName(i), reader.GetFieldType(i).ToString());
            }

            return entity;
        }
开发者ID:aytacozkan,项目名称:OGDI-DataLab,代码行数:14,代码来源:DbaseKmlEntityProducer.cs

示例12: LoadContent

        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font = Content.Load<SpriteFont>("Instruction");

            testTexture = Content.Load<Texture2D>("crate");
            testTextureII = Content.Load<Texture2D>("Bricks");

            Entity TestEnt = new Entity("VertexCrate");
            TestEnt.AddProperty<Vector3>("Position", new Vector3(0, 0, 0));
            TestEnt.AddProperty<Vector3>("Scale", new Vector3(2, 2, 2));
            TestEnt.AddProperty<Vector3>("Rotation", new Vector3(0,0,0));
            TestEnt.AddProperty<Texture2D>("Texture", testTexture);
            TestEnt.AddProperty<Texture2D>("BrickTexture", testTextureII);
            TestEnt.AddProperty<GraphicsDevice>("GraphicsDevice", GraphicsDevice);
            TestEnt.AddProperty<ContentManager>("Content", Content);
            TestEnt.AddBehaviour(CrateTest);
            TestEnt.AddBehaviour(Collide);
            BigOlEntityList.Add(TestEnt);

            Entity ThreeDReference = new Entity("XZ Plane");
            ThreeDReference.AddProperty<GraphicsDevice>("GraphicsDevice", GraphicsDevice);
            ThreeDReference.AddProperty<Vector3>("Position", new Vector3(0, 0, 0));
            ThreeDReference.AddProperty<Vector3>("Scale", new Vector3(1));
            ThreeDReference.AddProperty<Vector3>("Rotation", new Vector3(0, 0, 0));
            ThreeDReference.AddBehaviour(new RefPlane(50, Matrix.Identity, Color.DarkGreen));
            ThreeDReference.AddBehaviour(new RefPlane(50, Matrix.CreateRotationZ(MathHelper.PiOver2), Color.DarkRed));
            ThreeDReference.AddBehaviour(new RefPlane(50, Matrix.CreateRotationX(MathHelper.PiOver2), Color.OliveDrab));

            BigOlEntityList.Add(ThreeDReference);

            rsDefaultState.CullMode = CullMode.CullCounterClockwiseFace;
            rsDefaultState.FillMode = FillMode.Solid;
        }
开发者ID:Chronojam,项目名称:Tangle,代码行数:38,代码来源:Game1.cs

示例13: UpdateProperties

        private void UpdateProperties(int i, Entity newEntity)
        {
            List<string> checkedColumnNames = new List<string>();

            for (int rowIndex = 3; rowIndex < advTree1.Nodes.Count; rowIndex++)
            {
                string columnName = advTree1.Nodes[rowIndex].Text;
                List<Property> mappedProperties = newEntity.Properties.Where(p => p.MappedColumn() != null && p.MappedColumn().Name == columnName).ToList();

                if (advTree1.Nodes[rowIndex].Cells[i].Checked)
                {
                    if (mappedProperties.Count == 0)
                    {
                        IColumn column = Table.Columns.Single(c => c.Name == columnName);
                        Property newProperty = ArchAngel.Providers.EntityModel.Controller.MappingLayer.OneToOneEntityProcessor.CreatePropertyFromColumn(column);
                        newEntity.AddProperty(newProperty);
                    }
                }
                else
                    for (int propIndex = mappedProperties.Count - 1; propIndex >= 0; propIndex--)
                        newEntity.RemoveProperty(mappedProperties[propIndex]);
            }
        }
开发者ID:uQr,项目名称:Visual-NHibernate,代码行数:23,代码来源:InheritanceHierarchy.cs

示例14: GetEntitiesEnumerator


//.........这里部分代码省略.........
                #endregion

                try
                {
                    XElement placemark = placemarks[i];

                    if (placemark == null)
                        continue;

                    foreach (var item in properties)
                    {
                        #region RDF

                        var header = item.Key;
                        var stringValue = item.Value;
                        var rdfValue = String.Empty;

                        if (header == Params.ProcessorParams.PartitionKeyPropertyName)
                        {
                            rdfXmlDescriptionElement.Add(new XAttribute(rdfNamespace + "about", stringValue));
                        }

                        var datatype = GetRdfType(stringValue);
                        var cleanHeader = CleanStringLower(header);

                        var columnNs = columnMetadata.First(column => column.column == header);
                        XNamespace customNS = columnNs.columnnamespace.ToString().Split('=')[1];

                        #endregion

                        // Name & Description of Placemark
                        if (item.Key == DataLoaderConstants.ElemNameName || item.Key == DataLoaderConstants.ElemNameDescription)
                        {
                            entity.AddProperty(item.Key,
                                               placemark.Element(kmlNamespace + item.Key).Value);

                            #region RDF
                            rdfValue = placemark.Element(kmlNamespace + header).Value;
                            #endregion
                        }

                        if (item.Key == DataLoaderConstants.PropNameKmlCoords
                            || (item.Key == DataLoaderConstants.PropNameLatitude && properties.ContainsKey(DataLoaderConstants.PropNameLongitude)))
                        {
                            if (placemark.Element(kmlNamespace + DataLoaderConstants.ElemNamePoint) != null)
                            {
                                var point = placemark.Element(kmlNamespace + DataLoaderConstants.ElemNamePoint);
                                var positionTuple =
                                    point.Element(kmlNamespace + DataLoaderConstants.ElemNameCoordinates).Value.Split(',');

                                entity.AddProperty(DataLoaderConstants.PropNameLatitude, ExtractLatitude(positionTuple));
                                entity.AddProperty("longitude", ExtractLongitude(positionTuple));
                                entity.AddProperty("altitude", ExtractAltitude(positionTuple));
                                //entity.AddProperty(DataLoaderConstants.PropNameKmlSnippet,
                                //                   string.Concat("<Placemark>", point.ToString(SaveOptions.DisableFormatting), "</Placemark>"));

                                #region RDF

                                if (stringValue != string.Empty)
                                {
                                    rdfXmlDescriptionElement.Add(new XElement(customNS + "latitude", ExtractLatitude(positionTuple), new XAttribute(rdfNamespace + "datatype", datatype)));
                                    rdfXmlDescriptionElement.Add(new XElement(customNS + "longitude", ExtractLongitude(positionTuple), new XAttribute(rdfNamespace + "datatype", datatype)));
                                    if (!string.IsNullOrEmpty(ExtractAltitude(positionTuple)))
                                        rdfXmlDescriptionElement.Add(new XElement(customNS + "altitude", ExtractAltitude(positionTuple), new XAttribute(rdfNamespace + "datatype", datatype)));
                                }
                                else
开发者ID:aytacozkan,项目名称:OGDI-DataLab,代码行数:67,代码来源:KmlEntityProducer.cs


注:本文中的System.Entity.AddProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。