本文整理汇总了C#中EntityCollection类的典型用法代码示例。如果您正苦于以下问题:C# EntityCollection类的具体用法?C# EntityCollection怎么用?C# EntityCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityCollection类属于命名空间,在下文中一共展示了EntityCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Execute
public void Execute(EntityCollection entities)
{
if (!this.contentLoaded) {
throw new InvalidOperationException("Content not loaded");
}
this.ExecuteImpl(entities);
}
开发者ID:strager,项目名称:SpermGame,代码行数:8,代码来源:ScriptBase.cs
示例17: ChartRenderingInfo
public ChartRenderingInfo(EntityCollection entities)
{
base.\u002Ector();
ChartRenderingInfo chartRenderingInfo = this;
this.chartArea = (Rectangle2D) new Rectangle2D.Double();
this.plotInfo = new PlotRenderingInfo(this);
this.entities = entities;
}
开发者ID:NALSS,项目名称:SmartDashboard.NET,代码行数:8,代码来源:ChartRenderingInfo.cs
示例18: ExecuteImpl
protected override void ExecuteImpl(EntityCollection entities)
{
var bulletP = new Entity("bullet") {
Textured.Instance,
Order2Update.Instance,
new CustomOnEscape(new BoundingBox2(
new Vector2(0, 0),
new Vector2(640, 480)
), (e) => {
entities.EnqueueDestroy(e);
}),
{ Textured.Texture, this.bulletTexture },
{ Properties.DestroysEnemies, true },
{ Properties.Damage, 10.0f },
{
Collidable.Body,
new Body(new ShapePrimitive[] {
new CircleShape(Vector2.Zero, 8)
})
},
};
var basicWeapon = new Entity {
new CustomBulletEmitter((e, weaponOwner) => {
var bullet = bulletP.Create();
bullet.Set(Located.Position, e.Get(Located.Position) + weaponOwner.Get(Located.Position));
bullet.Set(Located.Velocity, e.Get(Located.Velocity));
bullet.Set(Properties.Owner, weaponOwner);
entities.EnqueueSpawn(bullet);
})
};
var weapons = new[] {
basicWeapon.Create("top").Configure((e) => {
e.Set(Located.Position, new Vector2(0, 0));
e.Set(Located.Velocity, new Vector2(7, 0));
}),
basicWeapon.Create("bottom").Configure((e) => {
e.Set(Located.Position, new Vector2(0, 30));
e.Set(Located.Velocity, new Vector2(7, 0));
}),
basicWeapon.Create("center").Configure((e) => {
e.Set(Located.Position, new Vector2(0, 15));
e.Set(Located.Velocity, new Vector2(7, 0));
}),
};
this.weaponConfigs = new[] {
new[] { weapons[2], },
new[] { weapons[0], weapons[1], },
new[] { weapons[0], weapons[1], weapons[2], },
};
}
开发者ID:strager,项目名称:SpermGame,代码行数:58,代码来源:ShipBulletScript.cs
示例19: GetProductsTest
public void GetProductsTest()
{
var _products = new EntityCollection<Product>().AsQueryable();
mockProductRepository.Setup(x => x.GetAll()).Returns(_products);
var products = purcService.GetProducts();
Assert.IsNotNull(products);
Assert.IsInstanceOfType(products, typeof(IQueryable<IMaster>));
mockProductRepository.Verify(x => x.GetAll());
}
开发者ID:DotNetPracticeTeam,项目名称:DotNetPracticeApps,代码行数:9,代码来源:PurchaseRepositoryTest.cs
示例20: AdaptAddresses
internal static IQueryable<BL.DomainModel.Address> AdaptAddresses(EntityCollection<Address> addressCollection)
{
if (addressCollection.IsLoaded == false)
return null;
var addresses = from a in addressCollection.AsEnumerable()
select AdaptAddress(a);
return addresses.AsQueryable();
}
开发者ID:ikelos555,项目名称:HSROrderApp,代码行数:9,代码来源:AddressAdapter.cs
注:本文中的EntityCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论