本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
示例5: ExpressionContext
public ExpressionContext(ISession session, EntityCollection entityCollection, string scopeQualifier, string dynamicPropertiesContainerName)
{
this.Session = session;
this.EntityCollection = entityCollection;
this.ScopeQualifier = scopeQualifier;
this.DynamicPropertiesContainerName = dynamicPropertiesContainerName;
}
示例6: InitPos
internal void InitPos(EntityCollection collection)
{
sw.WriteLine("Init position");
saveCollection(collection);
sw.WriteLine("End init position");
sw.Flush();
}
示例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();
}
}
}
示例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;
}
示例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>();
}
示例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;
}
示例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;
}
}
}
示例12: ActionsQueue
public ActionsQueue(EntityCollection gameCollection, GameField field)
{
_field = field;
_queue = new List<Action>();
_size = _queue.Count;
_gameCollection = gameCollection;
}
示例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();
}
示例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;
}
示例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;
}