Quantcast
Channel: entityframework Discussions Rss Feed
Viewing all 1793 articles
Browse latest View live

New Post: SQL Server Compact 3.5 provider for EF6

$
0
0
Hi Erik,

I'm curious as to when people would use SQL Compact 3.5 as opposed to 4?

Thanks,
Arthur

New Post: SQL Server Compact 3.5 provider for EF6

$
0
0
Good question, Arthur, so was I.

But many people use SQL Server Merge Replication (or Sync Framework), and that only works with SQL Server Compact 3.5. In addition some devs have apps on mobile devices (Windows Mobile/Phone) which only supports 3.5 format, and then they move the database file to a desktop app, and they do not want to change the file format.

New Post: "MappingViewCacheFactory is already set and cannot be modified"

$
0
0
A fix for this has been checked-in and should be available in the next nightly build.

New Post: Issue migrating from VS2010 to VS2013

$
0
0
Hi
I'm having a very odd problem with a DbContext model-first project that I'm migrating from VS2020 (EF6.01) to VS2013. The designer was not happy with the EDMX version 2.0 file I had, so it upgraded it and I've deleted all the existing code generation items / added the EF6 DbContext generator. Everything compiles / runs correctly, however on choosing 'Generate Database from Model' this pops up:
Expression of type 'System.Data.Entity.Core.Metadata.Edm.EdmItemCollection' cannot be used for return type 'System.Data.Entity.Core.Metadata.Edm.EdmItemCollection'
There's possibly something in my EDMX that's causing that but I can't seem to work out what. Anyone seen anything like this before? From a console command line I can 'get' to the SQL (... as IObjectContextAdapter).ObjectContext.CreateDatabaseScript()) so I think it must be designer related.

Thanks

New Post: Issue migrating from VS2010 to VS2013

$
0
0
This is weird indeed. Would it be possible for you to attach a repro project so that we could investigate this? (My gut feeling is that EntityFramework.dll was for some reason loaded in a non-default load context and for the CLR the same types look different). Also, do you see the same thing if you create a new project and try generating database from model?

Thanks,
Pawel

New Post: EF throws error when using connection string from App.config

$
0
0
I have test app with test DbContext class:
class TPContext : DbContext
{
    public TPContext() : base() { }

    public DbSet<T1> T1 { get; set; }
    public DbSet<T2> T2 { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Configurations.Add(new T1Config());
        modelBuilder.Configurations.Add(new T2Config());
        base.OnModelCreating(modelBuilder);
    }
}
By default, the connection string in App.config file should have the same name as context. Here's App.config:
<configuration>
  <configSections>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
  </configSections>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="v11.0" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  <connectionStrings>
        <add name="TPContext" provider="System.Data.SqlClient" connectionString="Server=Domain\SQL2014;Database=Test;Trusted_Connection=true" />
    </connectionStrings>
</configuration>
However, the error is thrown:

__An unhandled exception of type 'System.TypeInitializationException' occurred in EntityFramework.dll
Additional information: The type initializer for 'System.Data.Entity.Internal.AppConfig' threw an exception.__

I have also tried to explicitly point the connection name:
public TPContext() : base("name=TPContext") { }
But same error is thrown. The only cure I've found is to pass connection string itself to constructor:
public TPContext() : base(@"Server=Domain\SQL2014;Database=Test;Trusted_Connection=true;") { }
This works perfectly. Also I want to point out that the same error is thrown in EF5.

New Post: SQL Server Compact 3.5 provider for EF6

$
0
0
Hi Erik,

Do you think it would it be possible to support SQL CE 3.5 with the same codebase with just a different provider manifest token, similar to how e.g. the SQL Server provider supports multiple versions of SQL?

Thanks,
Diego

New Post: EF6 runtime DbContext/ObjectContext supports MEST?

$
0
0
Hi Kenji Uno,

Thanks a lot for confirming the fix!

Diego

New Post: EF throws error when using connection string from App.config

$
0
0
Since, I use VS 2013 Express, where Error Assistant is removed, I didn't see the actual error. I wrapped the code in try..catch and looked at InnerException. So, the problem is that I wrote "provider" instead of "providerName". :) The problem is solved. I'd like to remove this thread. :)

New Post: EF6 startup performance

$
0
0
Hello Goran,

I just wanted to provide you and update on this investigation. First of all, regarding the start up time regression you observed, we were able to repro and we believe we understand better what is happening. In our environment, the startup time looks like this:
  • EF 6.0.2 with the WPF application you provided: ~3400 ms
  • EF 6.0.2 with the model you provided inside a console application ~ 2600 ms
After we used "ngen Install EntityFramework.dll" from the Developer Command Prompt as described in our blog posts, the start up time for the console application went down to approximately 800 ms, but the start up time for the WPF application remained unchanged.

This helped us realize that the WPF application was simply no loading the native images produced by ngen. The reason is that while the console application would ran in 32-bit mode, a WPF application would ran in 64-bit in a 64-bit operating system by default. There are actually two different versions of ngen.exe that produce 32 and 64-bit native images. In order to reduce the start up time for the WPF application you need to use a version of ngen.exe from the c:\windows\microsoft.net\framework64 directory or alternatively run the ngen install command from the x64 Native Tools Command Prompt.

We also were able to shave approximately 100 additional milliseconds from start up time by also running ngen install on the EF provider, e.g. EntityFramework.SqlServer.dll.

All in all, once ngen install is applied successfully, our results show that the repro you provided starts faster with recent builds of EF 6.0.2 than with EF 5.0.

To address this issue we will provide improved instructions to use ngen in the future.

In the meanwhile, we haven reproduced the other two issues you described. I will give Pawel (the author of the view generation template for EF6) the heads up on the type loading exception.

Hope this helps,
Diego

New Post: SQL Server Compact 3.5 provider for EF6

$
0
0
Hi Diego,

Yes, certainly, but a new project (.csproj) file referencing the 3.5.1.0 version of the System.Data.SqlServceCe.dll (ADO.NET provider) will be required.

I have already created a "Proof of concept" provider, based on conditional compilation - the main change being changing the provider invariant name from "System.Data.SqlServerCe.4.0" to "System.Data.SqlServerCe.3.5" - (maybe that could be a constant somewhere). (And added a new NuGet package, of course). With the provider Token staing at 4.0, only 2 places in the codebase need to have conditional compilation statements added. (and the ProviderInvariantName const used throughout the codebase instead of a hardcoded string)

Based on your question, I assume that the provider manifest token can stay at 4.0, limiting the amount of changes, since there is feature parity between 3.5 and 4.0. No new types or functions was introduced in 4.0.

Does that make sense, or am I misunderstanding the purpose of the provider manifest token?

The only real code change required as I can see (based on limited testing for now) is the fact that 3.5 does not support DbSkipExpression.
(4.0 added support for ORDER BY .. OFFSET .. FETCH syntax). I am investigation if the IsCompatible method logic needs to be changed.

New Post: EF6 startup performance

$
0
0
Hi Diego,

happy to hear that problems that you were able to get down to problem cause.

Just to be clear, for the last two issues, you have been able to reproduce them, or you haven't?

Thanks,
Goran

New Post: Issue migrating from VS2010 to VS2013

$
0
0
This was one of those 'reboot and it goes' away problem - thanks for answering however. I haven't been able to reproduce it at all I'm afraid.
Thanks again

New Post: Issue migrating from VS2010 to VS2013

$
0
0
@adrianoneill I am glad it is working now. If it happens again and you have a stable repro let me know and I will take a look.

New Post: EF6 startup performance

$
0
0
Hi Goran,

We haven't reproduced the other two issues but to be honest we haven't been focusing on those with the same priority (we are trying to fix as many perf issues as we can in 6.0.2). Pawel has responded that he will look into the template issue soon.

Thanks,
Diego

New Post: strange behavior opening ef designer with vpn

$
0
0
Hi Luca

I think we'd expect that behavior. You're right that the Update Model from Database wizard will look to see if the connection a) exists and b) can be opened and if not will assume there's something wrong with the connection and so push you back to the "Choose Your Data Connection" page.

The wizard itself does not cache the connections but it is contacting the Server Explorer each time to ask for its list of connections and Server Explorer probably does cache. Server Explorer has a "Refresh" button on the top left. In the scenario where you open VS first, after you've connected to the vpn can you try pushing the Refresh button and then try the wizard? My suspicion is that will clear up your problem.

Lawrence

New Post: How to connect MySql database with Entity framework model

New Post: Testing with async queries doesn't work

$
0
0
@tugberk and @bowser15: You might want to take a look at the code in test\EntityFramework\FunctionalTests\TestDoubles in the EF git repository. In particular, MockableDbSetTests and InMemoryDbSetTests contain running examples of ToListAsync, etc.

Thanks,
Arthur

New Post: Updating EF4 Model from Database in VS2013 doesn't update

$
0
0
I have upgraded a VS2010 project using EF4 to VS2013 and everything seemed to be working fine, however I've added a new stored procedure to the database and I can't get the model to update. I've selected 'Update Model From Database' then chosen the new sproc from the treeview and clicked 'finish' but the model is not updated and I cannot see the sproc to link to a function.

I am able to add tables to my database and these are imported as entities, but no stored procedures.

Any ideas?

New Post: Updating EF4 Model from Database in VS2013 doesn't update

$
0
0
Ok, so i've solved it:

I needed to uncheck the "Import Selected Stored Procedures and Functions into the Entity Model".
Viewing all 1793 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>