Entity Framework Core Part 1

Play Entity Framework Core Part 1

The Discussion

  • User profile image

    How to create a special sequence id in Entity Framework core? It seems no online tutorial share about it since Entity Framework available.

    Please kindly share about it.

  • User profile image
    Love the scaffolding option! I always created my dbcontext manually, this is good because I can always take more control like including my connection string in the constructor or override methods, etc... another advantage of this one is that I can create custom object because not all the time I want to make all the fields on the tables, or all the tables.

    But in general I love the idea of the scaffolding option because you don't have to know anything about the objects in the database, is like an out of the box tool, this reminds me the old out of the box templates of Dreamweaver!

    unfortunately I think this is a little too much for New users because you are including a large number of tables, using a lot of options that you should start with more simple concept, one database, one or two tables, and explain the Dbcontext as simple as a connection to the database.
  • User profile image
    @sipi41: You could use EF Core Power Tools, makes it simple to just include a few tables (and much more)
  • User profile image

    Still doesn't support dynamic/raw sql without using a DbSet collection. Yawn.

  • User profile image

    Mr Green needs to take a healthy walk in the park.
    The presentation was wonderful.

  • User profile image

    Very interesting episode, but I have to just say that the command line usage for the scaffolding generation reminds me of what I hated about using Java and its ecosystem back in 2001 - no efficient tooling. It's one of the primary reasons that I switched to C# and that first version of VS.NET way back when. It's a shame to see EF Core and other framework efforts rolling back the clock and casting that attention to configuration/setup ease by the wayside. I fully understand that everything HAS to be able to be done via the command line for the very reasons stated, but to not include official tooling in VS - Microsoft's flagship IDE/editor - is a decision that I find very frustrating. I also understand that some developers have an affinity for command line usage, and more power to them, but I find it inefficient and impractical to incorporate into the already complicated daily workflow that many of us have - Phil himself even opted to paste the command into the console because it was very long and hairy to remember or type. For the same reason, I would guess that the majority of VS users work with the NuGet dialog 99% of the time instead of the Package Manager Console as an example. At the very least, I would have liked to have seen the unofficial VS extension that was mentioned, as this is after all a show called Visual Studio Toolbox that focuses on using Visual Studio. That being said, I thoroughly enjoyed the episode in general - great stuff - thanks.

  • User profile image
    I would completely agree. My company has been fully invested in the .NET Framework and know a lot about running ASP.NET and Entity the "old" way. We generated everything using a designer in Visual Studio, and whenever we add a new column, we just right-clicked and chose "Update" and everything would get updated for us along with a very nice visual view of our model.

    We have a new project coming up that we are going to make the "leap" into .NET Core. I've been reading Microsoft's documentation and just come onto Channel 9 to start watching some videos and saw this one on top. It is very helpful and a great start, and I'll be watching many more videos here. There is just so much new to learn. It's very frustrating that with all the great old visual tools, I really had no desire to use command-line for anything anymore and it looks like that's currently the only way.

    Also a little funny to me that the name of this series is "Visual Studio Toolbox" and thus far we have not seen much in Visual Studio....it's all been command-line.

    That being said, this was a great part one video and I'll continue watching and hopefully eventually all the new .NET Core things will begin to sink in.
  • User profile image
    @Kowloon: Saygılar hocama :)
  • User profile image
    I just started the series, but does this include any information on using existing SQL stored procedures for querying with multiple parameters in EF Core?
  • User profile image
    @DanW24:Up until version 3.x, Entity Framework in 2.x did not directly support stored procedures. For me that is fine since i dislike using them in the first place. I would look at articles like this on that https://www.entityframeworktutorial.net/efcore/working-with-stored-procedure-in-ef-core.aspx
  • User profile image
    @mkrajew:I would agree, but many people use core other than visual studio, i am however not one of those.
  • User profile image
    @Kowloon:if you are referring to an identity field, that is done in the database if using Database First method. That is then populated in the DbContext file and the class is decorated with a [Key] attribute. Other fields as guids can be added in the modelBuilder.Entity section.
    modelBuilder.Entity(entity => {
    entity.Property(e => e.AttachmentGUID).HasDefaultValueSql("(newid())");

  • User profile image
    @Richie: Doesn't DbContext.Database.ExecuteSqlCommand() or DbSet.FromSql() do what your want? I believe the goal of EF is to move away from hard coding SQL calls that cannot be validated at compile time like LINQ does. Just my opinion.
  • User profile image

    In the video, I can see the Lambda type next to the variable in Visual Studio. For ex

    entity.Property(e:Address => e.AddressID).HasMaxLength(100);

    In the above the variable "e" is followed by type i.e, ":Address". How to enable that settings in Visual Studio?

Add Your 2 Cents