Diego Vega

Diego Vega divega

Niner since 2004

Diego works at Microsoft as a Program Manager for Entity Framework and .NET data access APIs.

Coding for almost as long as I can remember, niner since 2004, until I was recruited by Microsoft in 2007. Drinking from a fire hose since then.

Entries

Comments

  • .NET Standard Deep Dive

    I have a 4.6.1 class library with entity framework DB connections. I want to use that with .NET Core 2.0, is that possible or will I have to convert the class library to .NET Standard?

    @Lars: sorry for the delayed answer. It depends on what "flavor" of Entity Framework you are currently using. Entity Framework 6 was built for .NET Framework and does not currently support .NET Standard or .NET Core. If you are already using Entity Framework Core, you should be able to move your code between .NET Framework and .NET Core without changes.

    If you are currently using Entity Framework 6 (or previous versions) but need to run on .NET Core, then moving your application to Entity Framework Core is worth considering, but beware that doing that is a porting exercise and not a simple version update.

    There is a comparison and recommendations for porting between the two in our documentation: https://docs.microsoft.com/en-us/ef/efcore-and-ef6/

    Hope this helps.

  • What's New in Entity Framework Core 2.0

    @Kumudu:yes, sample code can be obtained from https://github.com/anpete/efdemos/.

  • What's New in Entity Framework Core 2.0

    @Dex:video is now online.

  • What's New in Entity Framework Core 2.0

    @LeeReitz: You will still start getting brand new DbContext instances (as long as you don't run of memory).

    There is a pooSize argument on AddDbContextPool<T>() that allows you to control how many instances will remain in the pool ready to be resolved, but it doesn't limit how many DbContext instances can be created. The default poolSize, if you don't specify it is 32.

    Here is a more complete answer: https://github.com/aspnet/EntityFrameworkCore/issues/9426. 

  • Visual Studio Toolbox: Entity Framework Part 2

    @Atlantisbase: NuGet will be available in all SKUs of Visual Studio 11. Unfortunately I don't think there is a way to get NuGet to install in Visual C# Express 2010 or Visual Basic Express 2010, but here is a workaround:

    1. Go to the NuGet Gallery site: http://nuget.org
    2. Login (create a user account if necessary)
    3. Navigate to the packages section: http://nuget.org/packages
    4. Select EntityFramework and the version that you want to obtain
    5. Click on the Download link on the left (currently, the link only appears if you login)
    6. Rename the .NUPKG file to .ZIP and extract EntityFramework.dll
    7. Add EntityFramework.dll to your project manually

    This should give you access to all the functionality of DbContext and CodeFirst. I am not sure there is a way to manually register the Migrations scripts in Visual Studio though.

  • Visual Studio Toolbox: Entity Framework Part 2

    @Everyone: Here is a link to the EF 4.3 beta release announcement. You will find more information about what is included and how to get the bits: https://blogs.msdn.com/b/adonet/archive/2012/01/12/ef-4-3-beta-1-released.aspx.

    Thanks.

  • Visual Studio Toolbox: Entity Framework Part 1

    @felix9:I have forwarded your post to the RIA Services team.

  • Visual Studio Toolbox: Entity Framework Part 1

    @morteza: I am guessing that the exception message you tried to paste got mangled. Could you try again pasting it in notepad first before you put it here?

  • Visual Studio Toolbox: Entity Framework Part 1

    @Edson_Ferreira: I have seen this error come up when your login credentials actually lack the necessary permissions in SQL Server.

    This is often the consequence of installing SQL Express using a different user account from the one you are trying to use it. It has happened to me when I take a virtual machine image prepared by another person.

    One way to confirm this is your case would be to open SQL Server Management Studio logging in with your regular use account and attempt to create a database manually, e.g.:

    USE master;
    CREATE DATABASE delete_me_next;

    If you get the same error message you are getting is code first, there is your problem.

    You should be able to work around this by running Visual Studio and your Code First app as an administrator every time, but this is not very safe so I would recommend that you rather grant the required permissions to your login use in SQL Server permanently.

    There might be an easier way but you should be able to do the later this way:

    1. Starting SQL Server Management Studio as an administrator (you should now be able to create and drop databases)
    2. Expand the Root/Security/Logins node on the Object Explorer
    3. If there is an entry for your Windows account right click and open properties, otherwise create a new login for your Windows user account.
    4. Under Server Roles make sure there is a checkmark on a server role that has permissions to create databases, e.g. dbcreator or sysadmin.

    If this is not the reason CREATE DATABASE is failing, another possibility is that the local account under which the SQL Server service is running doesn't have the necessary file system permissions to create files in the default location for new databases (i.e. under the ...\MSSQL\DATA directory).

    Hope this helps.

  • Visual Studio Toolbox: Entity Framework Part 1

    @Lee Colins: Tugberk is right. DbContext and MVC both work with the "buddy class" pattern explained here: https://msdn.microsoft.com/en-us/library/ee256141.aspx (look for the MetadataType attribute in the article). This is your best option to specify data annotations for validtion if you are using code generation to get your entities. I would also add that DbContext validation checks string lenght and nullability constrainst specified in your EDM model without the need to have data annotations in your C# or VB classes.

  • Pablo Castro, Britt Johnston, Michael Pizzo: ADO.NET Entity Framework - One Year Later

    Charles wrote:
    

    The enzyme metaphor was perhaps misleading as enzymes can often break things down. In this case, they stimulate the production of innovation.



    Then I think you meant hormones Wink

  • S. Somasegar (Soma) and Scott Guthrie on Orcas Beta 2: What's in it?

    figuerres wrote:
    Still have a VS2005 Cube from Soma and crew...

    Oh, how I miss my ACE cube! A month ago my little son dropped it from the desk and it broke in dozen of pieces. I was so sad! I am not begging but I wish I could get a replacement Wink

    I am also dowloading beta 2 at home, using Avalanche. Very cool stuff!

View All