Quantcast
Channel: Entity Framework
Viewing all 10318 articles
Browse latest View live

Closed Unassigned: Make EF load data from database, not cache [2588]

$
0
0
I have asked this question [here](https://entityframework.codeplex.com/discussions/569592), but got no response.
So, here's the problem. I have lots of tables and lots of columns in them. The program is used by many users, so that each of them must see the changes of each other. As I said in that post, when I need fresh data from database, EF takes data not from database, but from local cache. In [similar post](https://entityframework.codeplex.com/discussions/569761) it was insisted to use fresh context every time I need fresh data. So, it means that every time EF will initialize quadrillions of tables and columns? This is not an option, really. Please, add some "LoadDataFromDatabase" method to clear local cache and populate it with fresh data.
Also, disposing context after binding retrieved data to DataGrid doesn't let edit data in it and persist because, well, the context has been disposed! The actual error "System.InvalidOperationException: The operation cannot be completed because the DbContext has been disposed".
Comments: __EF Team Triage:__ Using a contexts with a small scope that can be easily thrown away is the correct way to solve this stale data problem. You mentioned that your concern with this approach is that "every time EF will initialize quadrillions of tables and columns". EF does a lot of caching of metadata etc. and we have done work to optimize the context creation code path so that it should be fast. If you have a context with a lot of data then it seems that the bulk of time would be spent re-loading data. Using a fresh context is still going to be faster because you would need to load the same amount of data to refresh the existing objects but with a fresh context you don't need to worry about merging etc.

Edited Issue: Outer apply in query. Also the SQL query seems nicer if generated with EF5. [2413]

$
0
0
This has been reported by the user fsoikin as part of issue [2196](https://entityframework.codeplex.com/workitem/2196) but seems to be caused by a different problem.

__Model:__

```
public class A
{
public int Id { get; set; }
public string Name { get; set; }
}

public class B
{
public int Id { get; set; }
public virtual ICollection<A> As { get; set; }
public virtual C C { get; set; }
}

public class C
{
public int Id { get; set; }
public string X { get; set; }
public int Y { get; set; }
}

public class Db : DbContext
{
public DbSet<A> As { get; set; }
public DbSet<B> Bs { get; set; }
public DbSet<C> Cs { get; set; }

public Db() : base( "server=.;database=xx;integrated security=true" ) {}
}

static class Program
{
static void Main() {
var db = new Db();
var q = from c in db.Bs
let i = c.As.FirstOrDefault().Id
let j = db.As.FirstOrDefault( a => a.Id == i ).Name
select new {
c.Id,
z = new { c.C.X, c.C.Y }
};
var qs = q.ToString();
}

```

__SQL query:__

```
SELECT
[Project2].[Id] AS [Id],
[Extent4].[X] AS [X],
[Extent5].[Y] AS [Y]
FROM (SELECT
[Extent1].[Id] AS [Id],
[Extent1].[C_Id] AS [C_Id],
(SELECT TOP (1)
[Extent2].[Id] AS [Id]
FROM [dbo].[A] AS [Extent2]
WHERE [Extent1].[Id] = [Extent2].[B_Id]) AS [C1]
FROM [dbo].[B] AS [Extent1] ) AS [Project2]
OUTER APPLY (SELECT TOP (1) [Extent3].[Id] AS [Id]
FROM [dbo].[A] AS [Extent3]
WHERE [Extent3].[Id] = [Project2].[C1] ) AS [Limit2]
LEFT OUTER JOIN [dbo].[C] AS [Extent4] ON [Project2].[C_Id] = [Extent4].[Id]
LEFT OUTER JOIN [dbo].[C] AS [Extent5] ON [Project2].[C_Id] = [Extent5].[Id]
```

__Workarounds:__

```
var q = from b in db.Bs
let i = b.As.FirstOrDefault().Id
let j = db.As.FirstOrDefault( a => a.Id == i ).Name
join c in db.Cs on b.C.Id equals c.Id
select new {
b.Id,
z = new { c.X, c.Y }
};
```

or

```
var q = from c in db.Bs
let i = c.As.FirstOrDefault().Id
let j = db.As.FirstOrDefault(a => a.Id == i).Name
let k = c.C
select new
{
c.Id,
z = new {k.X, k.Y}
};

```

New Post: Please add support for F# projects

$
0
0
Hello.
I'm sorry. I can't speak English well.

I always use F# when I define models.
I would like to use the EF Power Tools.
I know that this tools are very good.

Now menus are not displayed in F# projects.
Could you support F# projects in the future?

Thank you.

New Post: Please add support for F# projects

$
0
0
Hello.
I'm sorry. I can't speak English well.

I always use F# when I define models.
I would like to use the EF Power Tools.
I know that this tools are very good.

Now menus are not displayed in F# projects.
Could you support F# projects in the future?

Thank you.

Created Unassigned: EF6.1.2 tools failed model update from MSSQL2008 [2593]

$
0
0
Failed update model from SQLServer 2008 with EF6.1.2 tools Beta 2 for VS14, while it's OK for beta1.

Unable to generate the model because of the following exception: 'System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.Data.SqlClient.SqlException: 对于此 DBCC 语句,参数 1 不正确。
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c(DbCommand t, DbCommandInterceptionContext`1 c)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
--- End of inner exception stack trace ---
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.Execute(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Entity.Core.EntityClient.EntityCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.LoadDataTable[T](String sql, Func`2 orderByFunc, DataTable table, EntityStoreSchemaFilterObjectTypes queryTypes, IEnumerable`1 filters, String[] filterAliases)
at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.LoadTableDetails(IEnumerable`1 filters)
at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.LoadStoreSchemaDetails(IList`1 filters)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.GetStoreSchemaDetails(StoreSchemaConnectionFactory connectionFactory)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.CreateStoreModel()
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.GenerateModel(List`1 errors)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModels(String storeModelNamespace, ModelBuilderSettings settings, List`1 errors)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModel(ModelBuilderSettings settings, IVsUtils vsUtils, ModelBuilderEngineHostContext hostContext)'.
Loading metadata from the database took 00:00:00.7383496.
Generating the model took 00:00:02.0279594.

Commented Unassigned: EF6.1.2 tools failed model update from MSSQL2008 [2593]

$
0
0
Failed update model from SQLServer 2008 with EF6.1.2 tools Beta 2 for VS14, while it's OK for beta1.

Unable to generate the model because of the following exception: 'System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.Data.SqlClient.SqlException: 对于此 DBCC 语句,参数 1 不正确。
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<Reader>b__c(DbCommand t, DbCommandInterceptionContext`1 c)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
--- End of inner exception stack trace ---
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition.Execute(EntityCommand entityCommand, CommandBehavior behavior)
at System.Data.Entity.Core.EntityClient.EntityCommand.ExecuteReader(CommandBehavior behavior)
at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.LoadDataTable[T](String sql, Func`2 orderByFunc, DataTable table, EntityStoreSchemaFilterObjectTypes queryTypes, IEnumerable`1 filters, String[] filterAliases)
at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.LoadTableDetails(IEnumerable`1 filters)
at Microsoft.Data.Entity.Design.VersioningFacade.ReverseEngineerDb.SchemaDiscovery.EntityStoreSchemaGeneratorDatabaseSchemaLoader.LoadStoreSchemaDetails(IList`1 filters)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.GetStoreSchemaDetails(StoreSchemaConnectionFactory connectionFactory)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.CreateStoreModel()
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelGenerator.GenerateModel(List`1 errors)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModels(String storeModelNamespace, ModelBuilderSettings settings, List`1 errors)
at Microsoft.Data.Entity.Design.VisualStudio.ModelWizard.Engine.ModelBuilderEngine.GenerateModel(ModelBuilderSettings settings, IVsUtils vsUtils, ModelBuilderEngineHostContext hostContext)'.
Loading metadata from the database took 00:00:00.7383496.
Generating the model took 00:00:02.0279594.
Comments: Ouch - see issue #2590

Commented Issue: TPC :: error when trying to use IA on the most-derived type of a 3-level TPC hierarchy [1988]

$
0
0
This was found during investigation of:
https://entityframework.codeplex.com/workitem/1830 (look at the bug for more details).

Consider the following 3-level TPC model:

```
public class ApplicationUser
{
public virtual string Id { get; set; }
}

public abstract class Ad
{
public int AdID { get; set; }
public int Foo { get; set; }
}

public class Boat : Ad
{
public int Bar { get; set; }
}

public class Yacht : Boat
{
public int Baz { get; set; }
public virtual ApplicationUser User { get; set; }
}

public class MyContext : DbContext
{
public DbSet<ApplicationUser> Users { get; set; }

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<ApplicationUser>().ToTable("AspNetUsers");
modelBuilder.Entity<Ad>();
modelBuilder.Entity<Boat>().Map(
m =>
{
m.MapInheritedProperties();
m.ToTable("Boats");
});

modelBuilder.Entity<Yacht>().Map(
m =>
{
m.MapInheritedProperties();
m.ToTable("Yachts");
});
}
}
```

exception is thrown:
The association 'Yacht_User' between entity types 'Yacht' and 'ApplicationUser' is invalid. In a TPC hierarchy independent associations are only allowed on the most derived types.

This doesn't seem right since Yacht is the most derived type in this hierarchy.

Another thing that is worth noting, is that if we create relationship between ApplicationUser and Boat (which now is in the middle of hierarchy), validation passes and migration is generated, even though according to the exception above, and the design - IAs should only be allowed for the most-derived type.

As per triage decision, assigning to Future release

Comments: Great! It seems to be working correctly in 6.1.2 beta. Thanks

Commented Unassigned: Make EF load data from database, not cache [2588]

$
0
0
I have asked this question [here](https://entityframework.codeplex.com/discussions/569592), but got no response.
So, here's the problem. I have lots of tables and lots of columns in them. The program is used by many users, so that each of them must see the changes of each other. As I said in that post, when I need fresh data from database, EF takes data not from database, but from local cache. In [similar post](https://entityframework.codeplex.com/discussions/569761) it was insisted to use fresh context every time I need fresh data. So, it means that every time EF will initialize quadrillions of tables and columns? This is not an option, really. Please, add some "LoadDataFromDatabase" method to clear local cache and populate it with fresh data.
Also, disposing context after binding retrieved data to DataGrid doesn't let edit data in it and persist because, well, the context has been disposed! The actual error "System.InvalidOperationException: The operation cannot be completed because the DbContext has been disposed".
Comments: But what about data binding?

Commented Feature: Better support for default values [44]

$
0
0
One example is allowing date properties to have a default of NOW
Comments: I'm absolutely astonished that EF has got to v6 with this gaping flaw still in place ... Clearly, and especially if EF is really going to deliver on the DB neutrality front, we want to have DB-generated values being taken into account by EF as they exist in the DB itself. We can of course, create code into our business objects to work around the issue but for me, default "catch-all" values for the DB should be handled by the DB, not our code ...

Created Unassigned: Unique Index for NOT NULL values [2594]

$
0
0
Hello,

If the Index attribute is used with IsUnique=true, NULL values are considered and unique.

It should be specified "IgnoreNullValue" in attribute to create UNIQUE INDEX WHERE IS NOT NULL or add the clause on nullable columns.

Thank you,
Best regards,
Yann




Created Unassigned: VerifyTypeSupportedForComparison [2595]

$
0
0
We are hitting an issue using projections from entity framework to DTOs in an OData project.

The exception is: Cannot compare 'member 'xxx' of type 'yyy''. Only primitive types, enumeration types and entity types are supported.

The exception is thrown in the VerifyTypeSupportedForComparison method of the ExpressionConverter class. This method references a known bug (SQL BU 543956) we cannot find.

Also if we skip the check (in our case the BuiltInTypeKind is CollectionType) the query executes as expected.

Our question are, why is the CollectionType case not supported? could this check be further refined to allow this case without facing the known bug? Can the CollectionType case simply be added?

Thank you

Commented Feature: Async and Stored Procedures (async ExecuteFunction) [1760]

$
0
0
Hi

is it possible
Comments: Is there any update to this as its been over 12 months and the feature is still not available. Thanks.

Commented Issue: error 2010: The Column 'ColumnName' specified as part of this MSL does not exist in MetadataWorkspace. [1021]

$
0
0
Hello,
I am using __EntityFramework.6.0.0-alpha3-20405__
I have some Code First TPH classes. The above error seem to appear randomly with certain InverseProperty associations. Any leads will be appreciated.

Here is the stack trace:

```
System.Data.Entity.Core.MappingException was unhandled
HResult=-2146232032
Message=Schema specified is not valid. Errors:
(631,12) : error 2010: The Column 'LineTotalAmount' specified as part of this MSL does not exist in MetadataWorkspace.
(632,12) : error 2010: The Column 'LineNetAmount' specified as part of this MSL does not exist in MetadataWorkspace.
(633,12) : error 2010: The Column 'VATPercentage' specified as part of this MSL does not exist in MetadataWorkspace.
(895,12) : error 2010: The Column 'CostEach' specified as part of this MSL does not exist in MetadataWorkspace.
Source=EntityFramework
StackTrace:
at System.Data.Entity.Core.Mapping.StorageMappingItemCollection.Init(EdmItemCollection edmCollection, StoreItemCollection storeCollection, IEnumerable`1 xmlReaders, IList`1 filePaths, Boolean throwOnError)
at System.Data.Entity.Core.Mapping.StorageMappingItemCollection..ctor(EdmItemCollection edmCollection, StoreItemCollection storeCollection, IEnumerable`1 xmlReaders)
at System.Data.Entity.ModelConfiguration.Edm.DbDatabaseMappingExtensions.ToStorageMappingItemCollection(DbDatabaseMapping databaseMapping, EdmItemCollection itemCollection, StoreItemCollection storeItemCollection)
at System.Data.Entity.ModelConfiguration.Edm.DbDatabaseMappingExtensions.ToMetadataWorkspace(DbDatabaseMapping databaseMapping)
at System.Data.Entity.Internal.CodeFirstCachedMetadataWorkspace..ctor(DbDatabaseMapping databaseMapping)
at System.Data.Entity.Infrastructure.DbCompiledModel..ctor(DbModel model)
at System.Data.Entity.Infrastructure.DbModel.Compile()
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.InternalContext.Initialize()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
at System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider()
at System.Linq.Queryable.FirstOrDefault[TSource](IQueryable`1 source)
at BGAE.Code.CreateAccount.CreateCashPurchase() in j:\CollectedGarbage\TestBgae\TestBgae\CreateAccount.cs:line 47
at TestBgae.Program.Main(String[] args) in j:\CollectedGarbage\TestBgae\TestBgae\Program.cs:line 14
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
```
Comments: Dim paramEx As ParameterExpression = Expression.Parameter(SourceTable.GetType, "ent") -----------------------------------------------------------------------------------^ SourceTable is EntitySet type Dim prop As MemberExpression = Expression.Property(paramEx, SearchColumn.Name) ----------------------------------------------------------------------------------------^ SearchColumn is PropertyInfo type In the above line it says SearchColumn not found in SourceTable... This is because Expression.Parameter expects IQueryable parameter's ElementType. In case of L2E we pass EntitySet's ElementType. The EntitySet is the tableInfo got from Dataspace.CSpace. The exact error is Instance property 'addnotes' is not defined for type 'System.Data.Entity.Core.Metadata.Edm.EntitySet' Here "addnotes" is the column name. This column name is available in the respective Table (EntitySet). The table name is not pluralized. We need a solution for this...

Created Unassigned: "The nested query does not have the appropriate keys." when Include()ing a relationship after joining to a table valued function [2596]

$
0
0
See attached project. The gist of it is: say you have a table valued function that you use as a filter, that returns Customer IDs. One way of using it with Entity Framework would be something like this:

```
IQueryable<Customer> includeBeforeFunctionJoinQuery = ctx.Customers
.Include(c => c.Messages)
.Join(ctx.GetSomeCustomers(), c => c.Id, id => id, (c, id) => c);
```

That behaves as expected: it returns only Customer objects that the TVF returns the IDs for and eagerly loads the Messages navigation property.

Now let's move the Include after the join.

```
IQueryable<Customer> includeAfterFunctionJoinQuery = ctx.Customers
.Join(ctx.GetSomeCustomers(), c => c.Id, id => id, (c, id) => c)
.Include(c => c.Messages);
```

That throws an exception "The nested query does not have the appropriate keys." when you run the query. Having an exception thrown if an Include() is used after the filter is bad for composability, opening the door for surprising errors when returning IQueryable<> from a function that later gets other things added to it.

Full exception details:
```
System.Data.Entity.Core.EntityCommandCompilationException
An error occurred while preparing the command definition. See the inner exception for details.
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree, DbInterceptionContext interceptionContext, IDbDependencyResolver resolver, BridgeDataReaderFactory bridgeDataReaderFactory, ColumnMapFactory columnMapFactory)
at System.Data.Entity.Core.EntityClient.Internal.EntityProviderServices.CreateCommandDefinition(DbProviderFactory storeProviderFactory, DbCommandTree commandTree, DbInterceptionContext interceptionContext, IDbDependencyResolver resolver)
at System.Data.Entity.Core.EntityClient.Internal.EntityProviderServices.CreateDbCommandDefinition(DbProviderManifest providerManifest, DbCommandTree commandTree, DbInterceptionContext interceptionContext)
at System.Data.Entity.Core.Common.DbProviderServices.CreateCommandDefinition(DbCommandTree commandTree, DbInterceptionContext interceptionContext)
at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlanFactory.CreateCommandDefinition(ObjectContext context, DbQueryCommandTree tree)
at System.Data.Entity.Core.Objects.Internal.ObjectQueryExecutionPlanFactory.Prepare(ObjectContext context, DbQueryCommandTree tree, Type elementType, MergeOption mergeOption, Boolean streaming, Span span, IEnumerable`1 compiledQueryParameters, AliasGenerator aliasGenerator)
at System.Data.Entity.Core.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__6()
at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func`1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<>c__DisplayClass7.<GetResults>b__5()
at System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
at System.Data.Entity.Core.Objects.ObjectQuery`1.<System.Collections.Generic.IEnumerable<T>.GetEnumerator>b__0()
at System.Data.Entity.Internal.LazyEnumerator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at EFJoinIncludeErrorRepro.Program.Main(String[] args) in c:\Users\Greg\Documents\Programming\EFJoinIncludeErrorRepro\EFJoinIncludeErrorRepro\Program.cs:line 40
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()


Inner exception:
System.NotSupportedException
The nested query does not have the appropriate keys.
at System.Data.Entity.Core.Query.PlanCompiler.NestPullup.ConvertToSingleStreamNest(Node nestNode, Dictionary`2 varRefReplacementMap, VarList flattenedOutputVarList, SimpleColumnMap[]& parentKeyColumnMaps)
at System.Data.Entity.Core.Query.PlanCompiler.NestPullup.Visit(PhysicalProjectOp op, Node n)
at System.Data.Entity.Core.Query.InternalTrees.PhysicalProjectOp.Accept[TResultType](BasicOpVisitorOfT`1 v, Node n)
at System.Data.Entity.Core.Query.InternalTrees.BasicOpVisitorOfT`1.VisitNode(Node n)
at System.Data.Entity.Core.Query.PlanCompiler.NestPullup.Process()
at System.Data.Entity.Core.Query.PlanCompiler.NestPullup.Process(PlanCompiler compilerState)
at System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Compile(List`1& providerCommands, ColumnMap& resultColumnMap, Int32& columnCount, Set`1& entitySets)
at System.Data.Entity.Core.Query.PlanCompiler.PlanCompiler.Compile(DbCommandTree ctree, List`1& providerCommands, ColumnMap& resultColumnMap, Int32& columnCount, Set`1& entitySets)
at System.Data.Entity.Core.EntityClient.Internal.EntityCommandDefinition..ctor(DbProviderFactory storeProviderFactory, DbCommandTree commandTree, DbInterceptionContext interceptionContext, IDbDependencyResolver resolver, BridgeDataReaderFactory bridgeDataReaderFactory, ColumnMapFactory columnMapFactory)
```

I am using Entity Framework 6.1.1 from NuGet.

I realize I can also do the filtering with .Contains() so this is not a blocking issue for me:

```
IQueryable<Customer> includeAfterFunctionContainsQuery = ctx.Customers
.Where(c => ctx.GetSomeCustomers().Contains(c.Id))
.Include(c => c.Messages);
```

This uses the [CodeFirstStoreFunctions](https://codefirstfunctions.codeplex.com/) library to access table valued functions in queries, apologies if it's a bug in that project instead.

Created Unassigned: have a easy way to create linq functions which can use in linq directly [2597]

$
0
0
As we use sql function and store procedure , if can have facility to create function in cpl (c#,vb) , and such as model first approach , it can create sql store procedure ,function in our database and can use directly in linq implementation . like __ToString(), Contains()__ , or other linq function provided already .




New Post: Visual Studio 2013 and DbProviderServices behaviour

$
0
0
DbProviderServices has been changed as described here

http://entityframework.codeplex.com/wikipage?title=Rebuilding%20EF%20providers%20for%20EF6

Visual Studio 2013, when I try to create a Database First object at the first wizard step calls IServiceProvider.GetService implemented in JetProviderFactory asking for System.Data.Common.DbProviderServices

What should the provider return here? A new DbProviderServices (System.Data.Entity.Core.Common.DbProviderServices)?

Returning System.Data.Entity.Core.Common.DbProviderServices, the Visual Studio shows the next Wizard Step with an error "An Entity Framework database provider compatible with the latest version of Entity Framework could not be found .........".

Reviewed: EF 6.1.1 (11月 28, 2014)

$
0
0
Rated 4 Stars (out of 5) - good good good good

Created Unassigned: underlying provider failed to open when i changed the property of database "copy always" to " do no copy" [2598]

$
0
0
this is my connection string please check it . if something is wrong tell me ??

< connectionStrings>

< add name="ClassLibrary1.Properties.Settings.Database1ConnectionString" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Database1.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />

< /connectionStrings>

Commented Issue: NotMapped on base property throws if derived type discovered first [481]

$
0
0
An exception is thrown when the derived entity type is discovered before the base entity type containing an ignored property.

"You cannot use Ignore method on the property 'BaseProperty' on type 'DerivedEntity' because this type inherits from the type 'BaseEntity' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type."

var modelBuilder = new DbModelBuilder();
modelBuilder.Entity<DerivedEntity>();
modelBuilder.Entity<BaseEntity>();
modelBuilder.Build(new DbProviderInfo("System.Data.SqlClient", "2008"));

public class BaseEntity
{
public long Id { get; set; }
[NotMapped]
public string BaseProperty { get; set; }
}

public class DerivedEntity : BaseEntity
{
}

## WORKAROUND ##

Here's the algorithm to fix your code if you get the exception "You cannot use Ignore method on the property 'PropertyX' on type 'TypeY' because this type inherits from the type 'TypeZ' where this property is mapped. To exclude this property from your model, use NotMappedAttribute or Ignore method on the base type.":

1. Are you calling modelBuilder.Entity<TypeY>().Ignore(p => p.PropertyX);?
Yes. Replace this call with modelBuilder.Entity<TypeZ>().Ignore(p => p.PropertyX);
Goto 3.
No. Goto 2.
2. There should be a NotMapped attribute on property 'PropertyX' that's defined on 'TypeZ'. Is 'TypeZ' included in the model? (i.e. it's a valid entity type and it isn't ignored)
Yes. Ensure that 'TypeZ' is discovered before 'TypeY', to do this put modelBuilder.Entity<TypeZ>(); before modelBuilder.Entity<TypeY>();
Goto 3.
No. Remove NotMapped attribute from property 'PropertyX'. For each 'TypeW' directly derived from 'Z' add modelBuilder.Entity<TypeW>().Ignore(p => p.PropertyX);
Goto 3.
3. Run your tests. Did you get another exception with the same text, but different types?
Yes. Goto 1.
No. Enjoy!


Comments: It seems like there is still a problem with ignoring base-class defined properties in EF 6.1, we are still forced to use the [NotMapped] workaround which is not a good solution for those who do not want to pollute their domain model with persistence-related attributes. Please also note that there are people out there in the world who are using fluent/configuration-based mappings, and this case is not considered here at all!

New Post: ITILmEga)) 'Gone Girl' Online Free Full Movie!!

$
0
0
Gone Girl Online , Gone Girl 2014 Full Movie , Watch Gone Girl Movie Online , Gone Girl Free Online , Gone Girl Full Movie , Gone Girl Free Streaming Gone Girl Film, Gone Girl film divx, Gone Girl Full Lenght Movie In Hd Format, Where To Buy The Gone Girl Film, Buy The Gone Girl Film!!! Watch Full Film Ipod Gone Girl , Gone Girl It Full Lenght Movie In Dvd Format, now I Want To Watch The Full Film Of Gone Girl online.

=.=.=.=.=.=.==.=.=.=.=.=.==.=.=.=.=.=.==.=.=.=.=.=.==.=.=.=.=.=.==.=

CLICK HERE >> http://tinyurl.com/p3fvv3e

CLICK HERE >> http://tinyurl.com/p3fvv3e

CLICK HERE >> http://tinyurl.com/p3fvv3e
=.=.=.=.=.=.==.=.=.=.=.=.==.=.=.=.=.=.==.=.=.=.=.=.==.=.=.=.=.=.==.


Spend a little time now for free register and you could benefit later. You will be able to stream or Watch Gone Girl Full Movie Streaming Online from your computer, tablet, TV or mobile device.

Watch Gone Girl 2014 Full Movie Online Streaming. Gone Girl is a thriller set in the nocturnal underbelly of contemporary Los Angeles. Jake Gyllenhaal stars as Lou Bloom, a driven young man desperate for work who discovers the high-speed world of L.A. crime journalism. Finding a group of freelance camera crews who film crashes, fires, murder and other mayhem, Lou muscles into the cut-throat, dangerous realm of nightcrawling - where each police siren wail equals a possible windfall and victims are converted into dollars and cents. Aided by Rene Russo as Nina, a veteran of the blood-sport that is local TV news, Lou blurs the line between observer and participant to become the star of his own story.

Tag : Watch Gone Girl , Gone Girl 2014 Full Movie Online, Watch Gone Girl 2014 Full Movie , Watch Gone Girl Movie Online , Gone Girl Download , Gone Girl Full Movie , Gone Girl Online , Gone Girl Film , Gone Girl Full Movie Online , Gone Girl Full Movie Stream , Gone Girl Watch Online

Watch TGone Girl - Part 1 Megashare
Watch TGone Girl - Part 1 Youtube
Watch TGone Girl - Part 1 Vioz
Watch TGone Girl - Part 1 Putlocker
Watch TGone Girl - Part 1 instanmovie
Watch TGone Girl - Part 1 Dailymotion
Watch TGone Girl - Part 1 IMDB
Watch TGone Girl - Part 1 MOJOboxoffice
Watch TGone Girl - Part 1 Streaming
Watch TGone Girl - Part 1 HD 1080p
Watch TGone Girl - Part 1 HDQ
Watch TGone Girl - Part 1 Megavideo
Watch TGone Girl - Part 1 Tube
Watch TGone Girl - Part 1 Download
Watch TGone Girl - Part 1 Torent
Watch TGone Girl - Part 1 HIGH quality definitons
Watch TGone Girl - Part 1 Mediafire
Watch TGone Girl - Part 1 4Shared
Watch TGone Girl - Part 1 Full Movie
Watch TGone Girl - Part 1 Full
Watch TGone Girl - Part 1 Streaming Full
Watch TGone Girl - Part 1 HDQ full
Watch TGone Girl - Part 1 Download Subtitle
Watch TGone Girl - Part 1 Subtitle English
Watch TGone Girl - Part 1 Download Full
Watch TGone Girl - Part 1
Watch TGone Girl - Part 1 Streaming


TGone Girl - Part 1 Full Movie Online
TGone Girl - Part 1 Full Movie Online
TGone Girl - Part 1 English Film Free Watch Online
TGone Girl - Part 1 English Film, TGone Girl - Part 1 English Full Movie Watch Online
TGone Girl - Part 1 English Full Movie Watch Online
TGone Girl - Part 1 Watch Online
TGone Girl - Part 1 English Full Movie Watch Online
TGone Girl - Part 1 Watch Online, Watch Online TGone Girl - Part 1
TGone Girl - Part 1 English Full Movie Download
TGone Girl - Part 1 English Full Movie Free Download
TGone Girl - Part 1 English Full Movie Online Free Download
TGone Girl - Part 1 Download
TGone Girl - Part 1 HD Full Movie Online
TGone Girl - Part 1 HD English Full Movie Download
TGone Girl - Part 1 English Full Movie
TGone Girl - Part 1 Full Movie Online
TGone Girl - Part 1 Movie Online
TGone Girl - Part 1 English Full Movie Watch Online
TGone Girl - Part 1 Full Movie Watch Online
TGone Girl - Part 1 English Full Movie Watch Online
TGone Girl - Part 1 Movie Watch Online
TGone Girl - Part 1 English Full Movie
TGone Girl - Part 1 Full Movie, TGone Girl - Part 1 Full Movie
TGone Girl - Part 1 English Full Movie Online
TGone Girl - Part 1 Film Online
TGone Girl - Part 1 English Film...
ITILmEga)) 'Gone Girl' Online Free Full Movie!!
Viewing all 10318 articles
Browse latest View live


Latest Images