[]
        
(Showing Draft Content)

C1.Data.Entities.EntityFrameworkExtensions.AsLive

AsLive Method

AsLive<T>(EntityCollection<T>)

Converts an System.Data.Entity.Core.Objects.DataClasses.EntityCollection<> to an editable live view.

Declaration
public static View<T> AsLive<T>(this EntityCollection<T> entities) where T : class, IEntityWithRelationships
Parameters
Type Name Description
EntityCollection<T> entities

The entity collection to convert.

Returns
Type Description
View<T>

The resulting live view.

Type Parameters
Name Description
T

The type of the entities in the entities.

AsLive<T>(ICollection<T>, EntityClientScope)

Converts a POCO System.Data.Entity.Core.Objects.DataClasses.EntityCollection<> to an editable live view.

Declaration
public static View<T> AsLive<T>(this ICollection<T> pocoCollection, EntityClientScope scope) where T : class
Parameters
Type Name Description
ICollection<T> pocoCollection

The entity collection to convert. It must be of type System.Data.Entity.Core.Objects.DataClasses.EntityCollection<>.

EntityClientScope scope

The EntityClientScope to which the entity owning this collection belongs (in which it was fetched by a query or created).

Returns
Type Description
View<T>

The resulting live view.

Type Parameters
Name Description
T

The type of the entities in the pocoCollection.

Remarks

When POCO objects are used (with proxies), navigation collection properties are typed as ICollection<T>, not System.Data.Entity.Core.Objects.DataClasses.EntityCollection<> (although they are System.Data.Entity.Core.Objects.DataClasses.EntityCollection<> at run time). That is why a special AsLive extension method must be used.

Exceptions
Type Condition
ArgumentException

The pocoCollection is not of type System.Data.Entity.Core.Objects.DataClasses.EntityCollection<>.