/// <summary>
 ///     Gets the EntityType of the given CLR type
 /// </summary>
 /// <param name="objectContext"> The context to look in. </param>
 /// <param name="clrType"> The CLR type </param>
 /// <returns> The entity type corresponding to the CLR type </returns>
 protected static EntityType GetEntityType(ObjectContext objectContext, Type clrType)
 {
     return(ModelHelpers.GetStructuralType <EntityType>(objectContext, clrType));
 }
 /// <summary>
 ///     Gets the entity set name for the given CLR type, assuming no MEST.
 /// </summary>
 /// <param name="objetContext"> The context to look in. </param>
 /// <param name="clrType"> The type to lookup. </param>
 /// <returns> The entity set name. </returns>
 protected static string GetEntitySetName(ObjectContext objetContext, Type clrType)
 {
     return(ModelHelpers.GetEntitySetName(objetContext, clrType));
 }
 /// <summary>
 ///     Gets the EntityType of the given CLR type
 /// </summary>
 /// <param name="dbContext"> The context to look in. </param>
 /// <param name="clrType"> The CLR type </param>
 /// <returns> The entity type corresponding to the CLR type </returns>
 protected static EntityType GetEntityType(DbContext dbContext, Type clrType)
 {
     return(ModelHelpers.GetEntityType(dbContext, clrType));
 }
 /// <summary>
 ///     Returns a simple SQL CE connection for the given context type.
 /// </summary>
 /// <typeparam name="TContext"> The type of the context to create a connection for. </typeparam>
 /// <returns> The connection. </returns>
 protected static DbConnection SimpleCeConnection <TContext>() where TContext : DbContext
 {
     return(ModelHelpers.SimpleCeConnection <TContext>());
 }
 /// <summary>
 ///     Gets the entity set name for the given CLR type, assuming no MEST.
 /// </summary>
 /// <param name="dbContext"> The context to look in. </param>
 /// <param name="clrType"> The type to lookup. </param>
 /// <returns> The entity set name. </returns>
 protected static string GetEntitySetName(DbContext dbContext, Type clrType)
 {
     return(ModelHelpers.GetEntitySetName(dbContext, clrType));
 }
 /// <summary>
 ///     Returns a simple SQL Server connection string to the local machine for the given context type.
 /// </summary>
 /// <typeparam name="TContext"> The type of the context to create a connection string for. </typeparam>
 /// <returns> The connection string. </returns>
 protected static string SimpleConnectionString <TContext>() where TContext : DbContext
 {
     return(ModelHelpers.SimpleConnectionString <TContext>());
 }
 /// <summary>
 ///     Returns a simple SQL Server connection string to the local machine using attached database
 ///     for the given context type.
 /// </summary>
 /// <typeparam name="TContext"> The type of the context to create a connection string for. </typeparam>
 /// <param name="useInitialCatalog">
 ///     Specifies whether the InitialCatalog should be created from the context name.
 /// </param>
 /// <returns> The connection string. </returns>
 protected static string SimpleAttachConnectionString <TContext>(bool useInitialCatalog = true) where TContext : DbContext
 {
     return(ModelHelpers.SimpleAttachConnectionString <TContext>(useInitialCatalog));
 }
 /// <summary>
 ///     Returns a simple SQL Server connection string to the local machine with the given database name.
 /// </summary>
 /// <param name="databaseName"> The database name. </param>
 /// <returns> The connection string. </returns>
 protected static string SimpleConnectionString(string databaseName)
 {
     return(ModelHelpers.SimpleConnectionString(databaseName));
 }
 /// <summary>
 ///     Returns the default name that will be created for the context of the given type.
 /// </summary>
 /// <typeparam name="TContext"> The type of the context to create a name for. </typeparam>
 /// <returns> The name. </returns>
 protected static string DefaultDbName <TContext>() where TContext : DbContext
 {
     return(ModelHelpers.DefaultDbName <TContext>());
 }
 /// <summary>
 ///     Asserts that there's no ObjectStateEntry for the given entity in the given ObjectContext.
 /// </summary>
 /// <param name="objectContext"> A ObjectContext instance. </param>
 /// <param name="entity"> The entity to lookup. </param>
 public static void AssertNoStateEntry(ObjectContext objectContext, object entity)
 {
     ModelHelpers.AssertNoStateEntry(objectContext, entity);
 }
 /// <summary>
 ///     Asserts that there's no ObjectStateEntry for the given entity in the given DbContext.
 /// </summary>
 /// <param name="dbContext"> A DbContext instance. </param>
 /// <param name="entity"> The entity to lookup. </param>
 public static void AssertNoStateEntry(DbContext dbContext, object entity)
 {
     ModelHelpers.AssertNoStateEntry(dbContext, entity);
 }
 /// <summary>
 ///     Gets the ObjectStateEntry for the given entity in the given ObjectContext.
 /// </summary>
 /// <param name="objectContext"> A ObjectContext instance. </param>
 /// <param name="entity"> The entity to lookup. </param>
 /// <returns> The ObjectStateEntry. </returns>
 protected static ObjectStateEntry GetStateEntry(ObjectContext objectContext, object entity)
 {
     return(ModelHelpers.GetStateEntry(objectContext, entity));
 }
 /// <summary>
 ///     Gets all GetStateEntries for the given ObjectContext,.
 /// </summary>
 /// <param name="objectContext"> A ObjectContext instance. </param>
 /// <returns> All state entries in the ObjectStateManager. </returns>
 protected static IEnumerable <ObjectStateEntry> GetStateEntries(ObjectContext objectContext)
 {
     return(ModelHelpers.GetStateEntries(objectContext));
 }
Exemple #14
0
 public void IsInModel()
 {
     Assert.NotNull(ModelHelpers.GetEntitySetName(_context, typeof(TStructuralType)));
 }