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


C# EntityCollection类代码示例

本文整理汇总了C#中EntityCollection的典型用法代码示例。如果您正苦于以下问题:C# EntityCollection类的具体用法?C# EntityCollection怎么用?C# EntityCollection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Go

        private static void Go(long userId)
        {
            var settings = new MongoServerSettings
            {
                Server = new MongoServerAddress("127.0.0.1", 27017),
                SafeMode = SafeMode.False
            };
            var mongoServer = new MongoServer(settings);

            var database = mongoServer.GetDatabase("Test");

            var map = new NoteMap();
            var collection = new EntityCollection<Note>(database, map.GetDescriptor(), true);

            var note = new Note
            {
                NoteID = "1",
                Title = "This is a book.",
                Content = "Oh yeah",
                UserID = 123321L
            };
            // collection.InsertOnSubmit(note);
            // collection.SubmitChanges();
            // var data = collection.SelectTo(n => new { n.NoteID, n.UserID });
            collection.Log = Console.Out;
            var a = 4;
            collection.Update(
                n => new Note { },
                n => true);
        }
开发者ID:jefth,项目名称:EasyMongo,代码行数:30,代码来源:Program.cs

示例2: getValuesFromLists

        public JArray getValuesFromLists(EntityCollection lists, bool translate, bool allAttributes)
        {
            var jsonLists = new JArray();

            foreach (var list in lists.Entities)
            {
                var jsonList = new JObject();

                foreach (var prop in list.GetType().GetProperties())
                {
                    if (prop.Name != "Item")
                    {
                        var val = prop.GetValue(list, null);

                        if (allAttributes | val != null)
                            jsonList[prop.Name] = val == null ? null : val.ToString();
                    }
                }

                jsonLists.Add(jsonList);
            }

            if (translate)
            {
                jsonLists = translateToDisplayName(jsonLists, "list");
            }

            return jsonLists;
        }
开发者ID:SteffeKeff,项目名称:DynamicsIntegration,代码行数:29,代码来源:CrmApiHelper.cs

示例3: GetCollection

        public static EntityCollection GetCollection()
        {
            EntityCollection tempList = null;

            using (SqlConnection myConnection = new SqlConnection(AppConfiguration.ConnectionString))
            {
                using (SqlCommand myCommand = new SqlCommand("usp_GetEntity", myConnection))
                {
                    myCommand.CommandType = CommandType.StoredProcedure;
                    myCommand.Parameters.AddWithValue("@QueryId", SelectTypeEnum.GetCollection);
                    myConnection.Open();
                    using (SqlDataReader myReader = myCommand.ExecuteReader())
                    {
                        if (myReader.HasRows)
                        {
                            tempList = new EntityCollection();
                            while (myReader.Read())
                            {
                                tempList.Add(FillDataRecord(myReader));
                            }

                        }
                        myReader.Close();
                    }
                }
            }

            return tempList;
        }
开发者ID:justyBig,项目名称:OGAstonEngineer,代码行数:29,代码来源:EntityDAL.cs

示例4: Create

        public Guid Create( Entity entity )
        {
            // TODO: can the ID be assigned manually? I can't remember
            Guid id = Guid.NewGuid();
            entity.Id = id;

            string name = entity.GetType().Name;
            if( data.ContainsKey( name ) == false ) {
                data.Add( name, new EntityCollection() );
            }

            if( name == "Entity" ) {
                Entity de = ( Entity )entity;
                // We set name here to support DynamicEntity
                name = de.LogicalName;
                de[name + "id"] = id;
            }
            else {
                entity.GetType().GetProperty( name + "id" ).SetValue( entity, id, null );
            }

            if( !data.ContainsKey( name ) ) {
                data[ name ] = new EntityCollection();
            }
            data[ name ].Entities.Add( entity );

            if( m_persist ) {
                PersistToDisk( m_filename );
            }

            return id;
        }
开发者ID:modulexcite,项目名称:FakeCRM,代码行数:32,代码来源:MockCrmService.cs

示例5: ExpressionContext

 public ExpressionContext(ISession session, EntityCollection entityCollection, string scopeQualifier, string dynamicPropertiesContainerName)
 {
     this.Session = session;
     this.EntityCollection = entityCollection;
     this.ScopeQualifier = scopeQualifier;
     this.DynamicPropertiesContainerName = dynamicPropertiesContainerName;
 }
开发者ID:ErikWitkowski,项目名称:Simple.OData.Client,代码行数:7,代码来源:ExpressionContext.cs

示例6: InitPos

 internal void InitPos(EntityCollection collection)
 {
     sw.WriteLine("Init position");
     saveCollection(collection);
     sw.WriteLine("End init position");
     sw.Flush();
 }
开发者ID:temik911,项目名称:audio,代码行数:7,代码来源:ReplayManager.cs

示例7: GetjournalSum

 public List<decimal> GetjournalSum(int periodId, int typeid, int entityid)
 {
     using (RecordAccessClient _Client = new RecordAccessClient(EndpointName.RecordAccess))
     {
         if (typeid.Equals(2))
         {
            // Entity _entity =
             EntityAccessClient _enClient = new EntityAccessClient(EndpointName.EntityAccess);
             EntityCollection _accountcollection = new EntityCollection(_enClient.QueryAllSubEntity(entityid));
             List<decimal> _allandsub = new List<decimal>();
             decimal _base = 0;
             decimal _sgd = 0;
             _accountcollection.Add(_enClient.Query2(entityid)[0]);
             foreach (Entity _entity in _accountcollection)
             {
                 if (_Client.GetjournalSum(periodId, typeid, _entity.EntityID).ToList().Count > 0)
                 {
                     _base += _Client.GetjournalSum(periodId, typeid, _entity.EntityID).ToList()[0];
                     _sgd += _Client.GetjournalSum(periodId, typeid, _entity.EntityID).ToList()[1];
                 }
             }
             _allandsub.Add(_base);
             _allandsub.Add(_sgd);
             return _allandsub.ToList();
         }
         else
         {
             return _Client.GetjournalSum(periodId, typeid, entityid).ToList();
         }
     }
 }
开发者ID:WiseLinProject,项目名称:Projects,代码行数:31,代码来源:DataEntryService.svc.cs

示例8: LoadFromDatabase

        public static EntityCollection LoadFromDatabase(string connectionString)
        {
            var entities = new EntityCollection();

            var schemaInfo = DatabaseSchemaInfo.LoadFromDatabase(connectionString);
            foreach (var table in schemaInfo.Tables)
            {
                var entity = new Entity
                {
                    Name = table.Name,
                    Schema = table.Schema,
                    Database = table.Database
                };
                entities.Add(entity);

                foreach (var column in table.Columns)
                {
                    var member = new EntityMember
                    {
                        Name = column.Name,
                        DataType = DataTypeInfo.FromSqlDataTypeName(column.DataType, column.IsNullable),
                        MaxLength = column.MaxLength,
                        DecimalPlaces = column.DecimalPlaces,
                        IsNullable = column.IsNullable,
                        IsPrimaryKey = column.IsPrimaryKey,
                        IsIdentity = column.IsIdentity,
                        IsComputed = column.IsComputed,
                        OrdinalPosition = column.OrdinalPosition
                    };
                    entity.Members.Add(member);
                }
            }

            return entities;
        }
开发者ID:anilmujagic,项目名称:Insula,代码行数:35,代码来源:EntityLoader.cs

示例9: Reset

 public override void Reset()
 {
     this.Trucks = new EntityCollection<TruckType>();
     this.VehicleGPSSet = new EntityCollection<VehicleGPSType>();
     this.DerivedVehicleGPSSet = new EntityCollection<DerivedVehicleGPSType>();
     this.VehicleGPSSetInGPS = new EntityCollection<VehicleGPSType>();
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:7,代码来源:ModelRefSvcDataSource.cs

示例10: GetSolutions

        /// <summary>
        /// Получаем набор неуправляемых решений для организации
        /// </summary>
        /// <param name="service">сервис</param>
        /// <returns></returns>
        public static EntityCollection GetSolutions(IOrganizationService service)
        {
            var solutions = new EntityCollection();

            QueryExpression q = new QueryExpression("solution");
            //Берем только неуправляемые решения
            q.Criteria.AddCondition(new ConditionExpression("ismanaged", ConditionOperator.Equal, false));
            //не берем специальные CRMные солюшены
            q.Criteria.AddCondition(new ConditionExpression("friendlyname", ConditionOperator.NotEqual, "Active Solution"));
            q.Criteria.AddCondition(new ConditionExpression("friendlyname", ConditionOperator.NotEqual, "Default Solution"));
            q.Criteria.AddCondition(new ConditionExpression("friendlyname", ConditionOperator.NotEqual, "Basic Solution"));
            q.Orders.Add(new OrderExpression("createdon", OrderType.Descending));
            q.ColumnSet = new ColumnSet("friendlyname", "uniquename", "version", "installedon");
            q.PageInfo = new PagingInfo()
            {
                Count = 200,
                PageNumber = 1
            };

            EntityCollection ec;
            do
            {
                ec = service.RetrieveMultiple(q);
                solutions.Entities.AddRange(ec.Entities);
                q.PageInfo.PageNumber++;
                q.PageInfo.PagingCookie = ec.PagingCookie;
            } while (ec.MoreRecords);

            return solutions;
        }
开发者ID:helekon,项目名称:MergeCustomization,代码行数:35,代码来源:DataHandler.cs

示例11: InsertArea1

 public Int64? InsertArea1(ForestArea forestArea, CadastralPoint[] cadastralPoints)
 {
     using (var db = new DefaultCS())
     {
         try
         {
             if (cadastralPoints != null)
             {
                 EntityCollection<CadastralPoint> cp = new EntityCollection<CadastralPoint>();
                 foreach (var cpp in cadastralPoints)
                 {
                     cp.Add(cpp);
                 }
                 forestArea.CadastralPoints1 = cp;
             }
             forestArea.CreatedDate = DateTime.Now;
             db.ForestAreas.AddObject(forestArea);
             db.SaveChanges();
             return forestArea.Id;
         }
         catch (Exception ex)
         {
             return null;
         }
     }
 }
开发者ID:saif859,项目名称:MAPS,代码行数:26,代码来源:AddArea.asmx.cs

示例12: ActionsQueue

 public ActionsQueue(EntityCollection gameCollection, GameField field)
 {
     _field = field;
     _queue = new List<Action>();
     _size = _queue.Count;
     _gameCollection = gameCollection;
 }
开发者ID:temik911,项目名称:audio,代码行数:7,代码来源:ActionsQueue.cs

示例13: AdaptSupplier

        internal static IQueryable<BL.DomainModel.Supplier> AdaptSupplier(EntityCollection<Supplier> supplierCollection)
        {
            if (supplierCollection.IsLoaded == false) return null;

            var suppliers = from s in supplierCollection.AsEnumerable()
                            select AdaptSupplier(s);
            return suppliers.AsQueryable();
        }
开发者ID:ikelos555,项目名称:HSROrderApp,代码行数:8,代码来源:SupplierAdapter.cs

示例14: Boom

 public Boom(Cell cell, GameTime gameTime, EntityCollection parent)
 {
     Texture = LogicService.boom;
     this.Cell = cell;
     startedTime = gameTime.Total.TotalSeconds;
     this.parent = parent;
     Order = 6;
 }
开发者ID:temik911,项目名称:audio,代码行数:8,代码来源:Boom.cs

示例15: Person

 public Person()
 {
     Trips = new EntityCollection<Trip>();
     friends = new EntityCollection<Person>((DataSourceManager.GetCurrentDataSource<TripPinServiceDataSource>()).People);
     Emails = new Collection<string>();
     AddressInfo = new Collection<Location>();
     this.Concurrency = DateTime.UtcNow.Ticks;
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:8,代码来源:TripPinModels.cs


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