What's the correct way to handle some simple database actions with EF 6.1.3? RRS feed

  • Question

  • I realize the title is very generic, so I'll go into more detail. I have experience working with Entity Framework, but most of my experience is with older versions of EF. Specifically EF 4.x. I'm writing a very simple app; it will return records from 2 look up tables, and insert a record into a data table. With EF 4.x what I would do is create a data model, a .EDMX file and then place the relevant tables onto the design surface. Then I'd have a data context object to work with in my C# code.

    However I get the feeling that it's different with newer versions of EF. I'm not even sure that there's a design surface any more. I've seen things like DbSet objects and other things. And I've done a little bit of development using newer versions of EF, specifically code first, or what might be more appropriate in this case code first with existing data. Because most certainly that is what I've got here. I don't want to replace or wipe out the existing data! And yet I tend to think more in terms of data contexts; I want to use what's appropriate for the newer versions of EF.

    I'm sure that ultimately it would be good for me to get into a class (which unfortunately won't happen) or do some training on my own. I'll do that as I can, but in the interim I'd like to know how I can do what I want to do with two lookup tables and one data table that I've got to insert one record at a time into. Could someone please give me a quick run down as to how to do this?


    Wednesday, April 22, 2015 10:41 PM