本文整理汇总了C#中IEntityCollection类的典型用法代码示例。如果您正苦于以下问题:C# IEntityCollection类的具体用法?C# IEntityCollection怎么用?C# IEntityCollection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IEntityCollection类属于命名空间,在下文中一共展示了IEntityCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RelationMemberTests
public RelationMemberTests()
{
Mock<IEntityCollection<IOsmGeometry>> _nodesCollectionM = new Mock<IEntityCollection<IOsmGeometry>>();
_nodesCollectionM.SetupGet(c => c[1, EntityType.Node]).Returns(new Node(1, 1.1, 2.2));
_nodesCollectionM.Setup(c => c.Contains(1, EntityType.Node)).Returns(true);
_nodesEntityCollection = _nodesCollectionM.Object;
}
示例2: WayTests
public WayTests()
{
Mock<IEntityCollection<IOsmGeometry>> _nodesCollectionM = new Mock<IEntityCollection<IOsmGeometry>>();
_nodesCollectionM.SetupGet(c => c[1, EntityType.Node]).Returns(_nodes[0]);
_nodesCollectionM.SetupGet(c => c[2, EntityType.Node]).Returns(_nodes[1]);
_nodesCollectionM.SetupGet(c => c[3, EntityType.Node]).Returns(_nodes[2]);
_nodesEntityCollection = _nodesCollectionM.Object;
}
示例3: BindableGrid
public BindableGrid(string id, IEntityCollection dataCollection)
{
this.ID = id;
this.Value = null;
this.Collection = dataCollection;
if (this.Collection != null && this.Collection.IDbTable.PrimaryKey.Count > 0)
this.ColumnName = this.Collection.IDbTable.PrimaryKey[0].ColumnName;
}
示例4: GetMultiUsingRolesWithAuditAction
/// <summary>Retrieves in the calling AuditActionCollection object all AuditActionEntity objects which are related via a relation of type 'm:n' with the passed in RoleEntity.</summary>
/// <param name="containingTransaction">A containing transaction, if caller is added to a transaction, or null if not.</param>
/// <param name="collectionToFill">Collection to fill with the entity objects retrieved</param>
/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query. When set to 0, no limitations are specified.</param>
/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
/// <param name="entityFactoryToUse">The EntityFactory to use when creating entity objects during a GetMulti() call.</param>
/// <param name="roleInstance">RoleEntity object to be used as a filter in the m:n relation</param>
/// <param name="prefetchPathToUse">the PrefetchPath which defines the graph of objects to fetch.</param>
/// <param name="pageNumber">The page number to retrieve.</param>
/// <param name="pageSize">The page size of the page to retrieve.</param>
/// <returns>true if succeeded, false otherwise</returns>
public bool GetMultiUsingRolesWithAuditAction(ITransaction containingTransaction, IEntityCollection collectionToFill, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IEntityFactory entityFactoryToUse, IEntity roleInstance, IPrefetchPath prefetchPathToUse, int pageNumber, int pageSize)
{
RelationCollection relations = new RelationCollection();
relations.Add(AuditActionEntity.Relations.RoleAuditActionEntityUsingAuditActionID, "RoleAuditAction_");
relations.Add(RoleAuditActionEntity.Relations.RoleEntityUsingRoleID, "RoleAuditAction_", string.Empty, JoinHint.None);
IPredicateExpression selectFilter = new PredicateExpression();
selectFilter.Add(new FieldCompareValuePredicate(roleInstance.Fields[(int)RoleFieldIndex.RoleID], ComparisonOperator.Equal));
return this.GetMulti(containingTransaction, collectionToFill, maxNumberOfItemsToReturn, sortClauses, entityFactoryToUse, selectFilter, relations, prefetchPathToUse, pageNumber, pageSize);
}
示例5: BulkInsert
public void BulkInsert(IConnectionProvider conn, IEntityCollection newEntities, IEntityDaoFactory daoFactory)
{
if (newEntities.Count == 0)
return;
DataTable newRecords = newEntities.ToDataTable();
var bulkCopy = BuildSqlBulkCopy(conn, newEntities.IDbTable.TableName, newRecords);
bulkCopy.WriteToServer(newRecords);
}
示例6: ProductCollection
/// <summary>
/// Initializes a new instance of the <see cref="ProductCollection"/> class.
/// </summary>
/// <param name="entityCollection">
/// The <see cref="IEntityCollection"/>.
/// </param>
/// <exception cref="Exception">
/// Throws an exception if the <see cref="IEntityCollection"/> is not a product collection
/// </exception>
internal ProductCollection(IEntityCollection entityCollection)
{
Mandate.ParameterNotNull(entityCollection, "entityCollection");
if (entityCollection.EntityTfKey != Core.Constants.TypeFieldKeys.Entity.ProductKey)
{
throw new Exception("Must be a product collection");
}
this._entityCollection = entityCollection;
}
示例7: EntityCollectionProxyBase
/// <summary>
/// Initializes a new instance of the <see cref="EntityCollectionProxyBase"/> class.
/// </summary>
/// <param name="collection">
/// The collection.
/// </param>
protected EntityCollectionProxyBase(IEntityCollection collection)
{
this.Key = collection.Key;
this.ParentKey = collection.ParentKey;
this.ProviderKey = collection.ProviderKey;
this.SortOrder = collection.SortOrder;
this.Name = collection.Name;
this.ExtendedData = collection.ExtendedData;
this.Initialize(collection.ProviderKey);
}
示例8: GetMulti
/// <summary>Retrieves in the calling MembershipCollection object all MembershipEntity objects which have data in common with the specified related Entities. If one is omitted, that entity is not used as a filter. </summary>
/// <param name="containingTransaction">A containing transaction, if caller is added to a transaction, or null if not.</param>
/// <param name="collectionToFill">Collection to fill with the entity objects retrieved</param>
/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query. When set to 0, no limitations are specified.</param>
/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
/// <param name="entityFactoryToUse">The EntityFactory to use when creating entity objects during a GetMulti() call.</param>
/// <param name="filter">Extra filter to limit the resultset. Predicate expression can be null, in which case it will be ignored.</param>
/// <param name="roleInstance">RoleEntity instance to use as a filter for the MembershipEntity objects to return</param>
/// <param name="storeInformationInstance">StoreInformationEntity instance to use as a filter for the MembershipEntity objects to return</param>
/// <param name="pageNumber">The page number to retrieve.</param>
/// <param name="pageSize">The page size of the page to retrieve.</param>
public bool GetMulti(ITransaction containingTransaction, IEntityCollection collectionToFill, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IEntityFactory entityFactoryToUse, IPredicateExpression filter, IEntity roleInstance, IEntity storeInformationInstance, int pageNumber, int pageSize)
{
this.EntityFactoryToUse = entityFactoryToUse;
IEntityFields fieldsToReturn = EntityFieldsFactory.CreateEntityFieldsObject(ProductSearchEngine.EntityType.MembershipEntity);
IPredicateExpression selectFilter = CreateFilterUsingForeignKeys(roleInstance, storeInformationInstance, fieldsToReturn);
if(filter!=null)
{
selectFilter.AddWithAnd(filter);
}
return this.PerformGetMultiAction(containingTransaction, collectionToFill, maxNumberOfItemsToReturn, sortClauses, selectFilter, null, null, null, pageNumber, pageSize);
}
示例9: GetMulti
/// <summary>Retrieves in the calling ForumCollection object all ForumEntity objects which have data in common with the specified related Entities. If one is omitted, that entity is not used as a filter. </summary>
/// <param name="containingTransaction">A containing transaction, if caller is added to a transaction, or null if not.</param>
/// <param name="collectionToFill">Collection to fill with the entity objects retrieved</param>
/// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query. When set to 0, no limitations are specified.</param>
/// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
/// <param name="entityFactoryToUse">The EntityFactory to use when creating entity objects during a GetMulti() call.</param>
/// <param name="filter">Extra filter to limit the resultset. Predicate expression can be null, in which case it will be ignored.</param>
/// <param name="sectionInstance">SectionEntity instance to use as a filter for the ForumEntity objects to return</param>
/// <param name="defaultSupportQueueInstance">SupportQueueEntity instance to use as a filter for the ForumEntity objects to return</param>
/// <param name="pageNumber">The page number to retrieve.</param>
/// <param name="pageSize">The page size of the page to retrieve.</param>
public bool GetMulti(ITransaction containingTransaction, IEntityCollection collectionToFill, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IEntityFactory entityFactoryToUse, IPredicateExpression filter, IEntity sectionInstance, IEntity defaultSupportQueueInstance, int pageNumber, int pageSize)
{
this.EntityFactoryToUse = entityFactoryToUse;
IEntityFields fieldsToReturn = EntityFieldsFactory.CreateEntityFieldsObject(SD.HnD.DAL.EntityType.ForumEntity);
IPredicateExpression selectFilter = CreateFilterUsingForeignKeys(sectionInstance, defaultSupportQueueInstance, fieldsToReturn);
if(filter!=null)
{
selectFilter.AddWithAnd(filter);
}
return this.PerformGetMultiAction(containingTransaction, collectionToFill, maxNumberOfItemsToReturn, sortClauses, selectFilter, null, null, null, pageNumber, pageSize);
}
示例10: EntityFilterGroup
/// <summary>
/// Initializes a new instance of the <see cref="EntityFilterGroup"/> class.
/// </summary>
/// <param name="collection">
/// The collection.
/// </param>
public EntityFilterGroup(IEntityCollection collection)
: base(collection.EntityTfKey, collection.ProviderKey)
{
this.ParentKey = collection.ParentKey;
this.Key = collection.Key;
this.CreateDate = collection.CreateDate;
this.UpdateDate = collection.UpdateDate;
this.Name = collection.Name;
this.IsFilter = collection.IsFilter;
this.ExtendedData = collection.ExtendedData;
this.SortOrder = collection.SortOrder;
this.Filters = new EntityFilterCollection();
this.ResetDirtyProperties();
}
示例11: BulkSave
public void BulkSave(IConnectionProvider conn, IEntityCollection entitiesToSave, IEntityDaoFactory daoFactory)
{
IEntityCollection newEntities, changedEntities, removedEntities;
SplitCollectionForInsertUpdateAndDeleteOperations(entitiesToSave, out newEntities, out changedEntities, out removedEntities);
bool connIsLocal = !conn.IsOpen;
if (connIsLocal)
conn.OpenConnection();
try
{
BulkInsert(conn, newEntities, daoFactory);
BulkUpdate(conn, changedEntities, daoFactory);
BulkDelete(conn, removedEntities, daoFactory);
}
finally
{
if (connIsLocal)
conn.CloseConnection();
}
}
示例12: SplitCollectionForInsertUpdateAndDeleteOperations
private static void SplitCollectionForInsertUpdateAndDeleteOperations(IEntityCollection entitiesToSave, out IEntityCollection newEntities, out IEntityCollection changedEntities, out IEntityCollection removedEntities)
{
IDbTable table = entitiesToSave.IDbTable;
newEntities = table.NewEntityCollection();
changedEntities = table.NewEntityCollection();
removedEntities = table.NewEntityCollection();
foreach (IEntity entity in entitiesToSave)
{
switch (entity.EntityState)
{
case EntityState.New:
newEntities.Add(entity);
break;
case EntityState.OutOfSync:
changedEntities.Add(entity);
break;
case EntityState.PendingDeletion:
removedEntities.Add(entity);
break;
}
}
}
示例13: ExportEntityCollection
// Exports an IEntityCollection to a table in given Document. BookmarkName is the name of the bookmark associated
// with the table.
public static dynamic ExportEntityCollection(string DocumentPath, string BookmarkName, int StartRow, bool BuildColumnHeadings, IEntityCollection collection, List<string> ColumnNames)
{
dynamic functionReturnValue = null;
List<ColumnMapping> mappings = new List<ColumnMapping>();
ColumnMapping map = default(ColumnMapping);
dynamic doc = null;
WordHelper wordProxy = new WordHelper();
// if Word is active then use it
if (!wordProxy.GetWord())
{
if (!wordProxy.CreateWord())
{
throw new System.Exception("Could not start Microsoft Word.");
}
}
wordProxy.OpenDocument(DocumentPath);
doc = wordProxy.Document;
foreach (string name in ColumnNames)
{
map = new ColumnMapping("", name);
map.TableField.DisplayName = name;
mappings.Add(map);
}
functionReturnValue = ExportEntityCollection(doc, BookmarkName, StartRow, BuildColumnHeadings, collection, mappings);
wordProxy.ShowDocument();
return functionReturnValue;
}
示例14: Convert
private IProductCollection Convert(IEntityCollection ec)
{
return new ProductCollection(ec);
}
示例15: VisitEntityCollection
protected override void VisitEntityCollection(IEntityCollection entityCollection, PropertyInfo propertyInfo)
{
if (propertyInfo.GetCustomAttributes(typeof(CompositionAttribute), false).Any())
{
bool lastIsChild = this._isChild;
this._isChild = true;
IEnumerable<Entity> children = entityCollection.Entities;
foreach (Entity child in children)
{
this.Visit(child);
}
this._isChild = lastIsChild;
}
}