/// <summary> /// Adds an <see cref="EntitySet"/> to this container with the specified <paramref name="supportedOperations"/>. /// </summary> /// <param name="set">The <see cref="EntitySet"/> to add to the container.</param> /// <param name="supportedOperations">The <see cref="EntitySetOperations"/> supported by this entity set.</param> internal void AddEntitySet(EntitySet set, EntitySetOperations supportedOperations) { set.Initialize(this, supportedOperations); this._entitySets[set.EntityType] = set; this._entityTypeMap[set.EntityType.Name] = set.EntityType; }
/// <summary> /// Gets a <see cref="DomainDataSourceView"/> that uses a mocked <see cref="PagedEntityList"/> /// as its source, configured to support the operations specified, and using the specified /// <paramref name="refreshCallback"/> as the <see cref="Action"/> to invoke when a /// <see cref="DomainDataSourceView.Refresh"/> is triggered. /// </summary> /// <param name="operationsSupported">The operations to be supported on the mock <see cref="EntitySet"/>.</param> /// <param name="refreshCallback">The <see cref="Action"/> to call when a refresh occurs.</param> /// <returns>The configured <see cref="DomainDataSourceView"/> that uses mocks.</returns> private static DomainDataSourceView GetConfigurableView(EntitySetOperations operationsSupported, Action refreshCallback) { MockEntityContainer ec = new MockEntityContainer(); ec.CreateSet <City>(operationsSupported); IPagedEntityList pagedList = new MockPagedEntityList(ec.GetEntitySet <City>(), null); PagedEntityCollectionView ecv = new PagedEntityCollectionView(pagedList, refreshCallback); return(new DomainDataSourceView(ecv)); }
private EntityCollection <City> CreateEntityCollection(EntitySetOperations operations, out EntitySet <City> entitySet) { DynamicEntityContainer container = new DynamicEntityContainer(); County county = new County { Name = "King", StateName = "WA" }; entitySet = container.AddEntitySet <City>(operations); container.AddEntitySet <County>(operations).Attach(county); int count = county.Cities.Count; // Makes sure the collection monitors the EntitySet return(county.Cities); }
public EntitySet <T> AddEntitySet <T>(EntitySetOperations operations) where T : Entity { base.CreateEntitySet <T>(operations); return(GetEntitySet <T>()); }
private EntitySet <T> CreateEntitySet <T>(EntitySetOperations operations) where T : Entity { DynamicEntityContainer container = new DynamicEntityContainer(); return(container.AddEntitySet <T>(operations)); }
public void CreateSet <TEntity>(EntitySetOperations operations) where TEntity : Entity, new() { base.CreateEntitySet <TEntity>(operations); }
/// <summary> /// Gets a <see cref="DomainDataSourceView"/> that uses a mocked <see cref="PagedEntityList"/> /// as its source, configured to support the operations specified. /// </summary> /// <param name="operationsSupported">The operations to be supported on the mock <see cref="EntitySet"/>.</param> /// <returns>The configured <see cref="DomainDataSourceView"/> that uses mocks.</returns> private static DomainDataSourceView GetConfigurableView(EntitySetOperations operationsSupported) { return(GetConfigurableView(operationsSupported, () => { })); }
/// <summary> /// Create an <see cref="EntitySet"/> in this container for the specified entity type /// </summary> /// <typeparam name="TEntity">The Entity type</typeparam> /// <param name="supportedOperations">The operations supported for the Entity type</param> protected void CreateEntitySet <TEntity>(EntitySetOperations supportedOperations) where TEntity : Entity { EntitySet set = new EntitySet <TEntity>(); this.AddEntitySet(set, supportedOperations); }
/// <summary> /// Gets a <see cref="DomainDataSourceView"/> that uses a mocked <see cref="PagedEntityList"/> /// as its source, configured to support the operations specified, and using the specified /// <paramref name="refreshCallback"/> as the <see cref="Action"/> to invoke when a /// <see cref="DomainDataSourceView.Refresh"/> is triggered. /// </summary> /// <param name="operationsSupported">The operations to be supported on the mock <see cref="EntitySet"/>.</param> /// <param name="refreshCallback">The <see cref="Action"/> to call when a refresh occurs.</param> /// <returns>The configured <see cref="DomainDataSourceView"/> that uses mocks.</returns> private static DomainDataSourceView GetConfigurableView(EntitySetOperations operationsSupported, Action refreshCallback) { MockEntityContainer ec = new MockEntityContainer(); ec.CreateSet<City>(operationsSupported); IPagedEntityList pagedList = new MockPagedEntityList(ec.GetEntitySet<City>(), null); PagedEntityCollectionView ecv = new PagedEntityCollectionView(pagedList, refreshCallback); return new DomainDataSourceView(ecv); }
/// <summary> /// Gets a <see cref="DomainDataSourceView"/> that uses a mocked <see cref="PagedEntityList"/> /// as its source, configured to support the operations specified. /// </summary> /// <param name="operationsSupported">The operations to be supported on the mock <see cref="EntitySet"/>.</param> /// <returns>The configured <see cref="DomainDataSourceView"/> that uses mocks.</returns> private static DomainDataSourceView GetConfigurableView(EntitySetOperations operationsSupported) { return GetConfigurableView(operationsSupported, () => { }); }