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

New Post: Default Value & CreateDatabaseScript

$
0
0
Hi,
i noticed that default values in ssdl property element is not taken into account when generating the script for database creation CreateDatabaseScript.

For example starting with this entity (ssdl)
<EntityType Name="Entity2Set">
    <Key>
      <PropertyRef Name="Id" />
    </Key>
    <Property Name="Id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
    <Property Name="Value" Type="nvarchar(max)" Nullable="true" DefaultValue="1" />
  </EntityType>
I would expect a create table sql statement looking like this
-- Creating table 'Entity2Set'
CREATE TABLE [dbo].[Entity2Set] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Value] nvarchar(max)  NULL default '1'
);
GO
What EF generates is:
-- Creating table 'Entity2Set'
CREATE TABLE [dbo].[Entity2Set] (
    [Id] int IDENTITY(1,1) NOT NULL,
    [Value] nvarchar(max)  NULL
);
GO
Note there isn't the default value on column [value].
Is this the expected behavior?

P.S. This behavior has been verified on both EF5 & EF6.

Regards, Max

New Post: Default Value & CreateDatabaseScript

$
0
0
Hi Max,

Currently the DefaultValue from the SSDL is not being used to generate the database script (also note that in the model first scenario you may not even have the SSDL). This value is used at runtime if you happen to have a non-nullable column in the database/SSDL that is not mapped in your model. In this case if there was not for the DefaultValue all inserts would fail since EF would not know what value to use for the non-mapped column since nulls are not allowed.

Pawel

New Post: Best practices for DbContext in project using IdentityDbContext

$
0
0
When creating a project that uses IdentityDbContext for authentication it is possible to treat this in much the same way as a standard dbContext and use codefirst from within this same context for example:
public class ApplicationDbContext : IdentityDbContextWithCustomUser<ApplicationUser>
{

    public DbSet<Product> Products { get; set; }
    protected override void OnModelCreating(System.Data.Entity.DbModelBuilder modelBuilder)
    {
        modelBuilder.HasDefaultSchema("MyData");
    }
}
Presuming the rest of my data is going to live in the same db Is this the best/expected approach to this or should I simply create a second dbContext for my entities

New Post: Best practices for DbContext in project using IdentityDbContext

$
0
0
Am also really hoping to see guidance on this - seems like the overwhelming number of use-cases hold that the domain's user entities have to bind to the authentication project membership provider - if EF is the ORM then obviously the provider's members are EF entities. So shouldn't we see a walk-thru that demonstrates the Membership Providerwhere the members are DbContext entities?

New Post: Best practices for DbContext in project using IdentityDbContext

$
0
0
Hello Transacta and Steve,

I am not aware of any fundamental technical reason not to share the DbContext you use with ASP.NET Identity with the rest of your application. In fact, as Steve mentions, in most cases the entities used for identity will play a role in the application's domain anyway and so there are usually more reasons to put them together than to keep them apart.

On the other hand, sometimes an application's domain may grow itself big or complex enough that splitting it into multiple partitions can help improve performance or other qualities such as the understandability and maintainability of the application's code. In those cases using a separate EF model for identity may be the best thing to do.

From a pragmatic perspective I would say that if ASP.NET Identity is flexible enough to accommodate your application's requirements, then most likely doing the simplest thing, i.e. sharing the context, should be your default choice.

I have forwarded your questions to the team working on ASP.NET Identity and they informed me that they have added this subject to their documentation plan.

Hope this helps,
Diego

New Post: Trouble with slowness using EF6 many-to-many

New Post: EF6 runtime DbContext/ObjectContext supports MEST?

$
0
0
Hi.

It is a good news!

My problem is gone.

I've confirmed that there is no problem in EntityFramework about this discussion.

There are problems in both NpgsqlSchema.msl and NpgsqlSchema.ssdl in Npgsql.

I've fixed them as far as I can. I'll send them to Npgsql developer team as a feedback.

If you have interest, here is my note to check association/association set in ssdl.
https://dl.dropboxusercontent.com/u/24560712/ef6/fixed_npgsql_msl_ssdl.png

FYI here is fixed one.
https://dl.dropboxusercontent.com/u/24560712/ef6/Npgsql_msl_ssdl_20131114.zip

Sorry to take your times so much.

thanks
kenji uno

New Post: Support SQL Server HierarchyId data type

$
0
0
Hi guys, are there any updates on this feature?
It would be very useful to have HierarchyId in list of supported types.
I can help you with development in case it will speed-up process.

Tomas Jecha
MVP

New Post: Support SQL Server HierarchyId data type

New Post: EF6 startup performance

$
0
0
Hi npnelson,

I finally found some time to give EF6 a try again. I have tried with the ngen, and it improved only for about 1s.

Still it is far away from even close match (3.5s longer initialization time), which is like 150+% worse performance. And with not so big model (20 entities).

New Post: EF6 startup performance

New Post: EF6 startup performance

$
0
0
Hi Diego

I have just tried out the 21114 version (for some reason did not work from the console,but I was able to install it through manager). Before I give the performance results, I will also mention another problem with EF6. In solution, WPF application does not use any classes from EF library, so it does not require reference to it.. And with EF5 that was working ok. With EF6, however, if I do not add reference to EF6 in main application (WPF), I get this exception:

Error 3 Unknown build error, 'Cannot resolve dependency to assembly 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' because it has not been preloaded. When using the ReflectionOnly APIs, dependent assemblies must be pre-loaded or loaded on demand through the ReflectionOnlyAssemblyResolve event.' MainWPFApplication

This will go away if I add EF6 through nuget. Why is this required?

AS for the performance, it is identical to 6.0.1

New Post: EF6 startup performance

$
0
0
Hi Goran_

Thanks for verifying. Is there a possibility that you can provide a repro for the perf issue and also for this exception?

Diego

New Post: EF6 startup performance

$
0
0
I will try my best to make a repro.

Regards,
Goran

New Post: EF6 startup performance

$
0
0
Thanks a lot. As soon as you have a repro for the perf issue please share it. If we find a fix on time there is a chance that we can include it in 6.0.2.

New Post: EF6 startup performance

$
0
0
Hi Diego,

I was able to reproduce both issues. How can I send you the project?

Regards,
Goran

New Post: EF6 startup performance

$
0
0
Hi Goran,

Thanks! The first choice would be to create two new bugs on https://entityframework.codeplex.com/WorkItem/Create and attach the repros to them but if you prefer you can send them over email, either as an attachment or sending me a link to a skydrive share.

My email address is the same as my alias here + at microsoft.com.

New Post: EF6 startup performance

$
0
0
Hi Diego,

Since I have created a project that reproduces both issues, I will send you one project, with detail explanation what is causing the problem. And then you can create issues on the CodePlex. To make it easier for you, Cannot resolve dependency problem is related to Generate Views Template. The moment I have inserted that template, it started generating that error.

AS soon as I clear a little bit more project, so you can only see the relevant stuff, I am sending it on your email. I guess that will be approx in 30 minutes.

Regards,
Goran

New Post: EF6 startup performance

$
0
0
Hi Goran,

Sounds good. And once more, thank you.

Diego

New Post: EF6 runtime DbContext/ObjectContext supports MEST?

$
0
0
Hi Kenji Uno.

Thanks again for reaching out to us. Although you may have been able to workaround it by making changes to the SSDL and MSL models used by Npgsql, it turns out that what you described in your original report was a legitimate issue in EF6, i.e. the way MSL and SSDL looked like in in the Npgsql provider was probably supported in EF5.

We have a fix now, which we are planning to make available in 6.0.2. In case you would like to verify that the fix works for you with the original MSL and SSDL artifacts, here are the download instructions for tomorrow's nightly build:

http://blogs.msdn.com/b/adonet/archive/2013/11/13/6-0-2-nightly-builds-available.aspx

Diego
Viewing all 1793 articles
Browse latest View live


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