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

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?
Rod

Never mind. I found a good example of what I'm looking for on Channel 9,
Code First to Existing Database (EF 6.1 Onwards). This is what I've done before, but not too often. Anyway, I hope this will help others.
Rod

Similar Messages

  • What's the correct way to handle changes in RDBMS/DBadapter?

    In my project all changes to the database are not done via Jdeveloper but via TOAD. This means DBadapters must be made aware of changes in the database.
    I tried to re-run the DBad.apter wizard twice (2 different services) - to make it aware of changes in the DB. Both times it failed. I think was after the import database tab. The next tab was just blank.
    So what's the correct way of reconile changes in the db backwards into Jdev?
    BTW, in the DBadapter wiz its not possible the remove a already imported table. How do I come across the situation where I want the DBadapter to point to af different table? - and possibly remove old references to another one - which might have been removed in the DB.
    As It is now - I have to re-work all my DBadapters, which is not very much fun...
    Rgds, Henrik

    Trust me, I hv done that umpteen nbr of times.
    I hate BA's coming to me with changes, for which I hv to modify the DB adapter.
    One big loop-hole with BPEL is if we try to modify the adapters/toplink, it doesnt tend to work properly.
    The manthra for such modifications is ... "recreate", which is definetely not a good practise.
    You may not like but gottu live with it, my friend.
    Pointing to a different table, I achieve it by doing a "Shift+Delete" to all the references of the old table in the BPEL project ... :|
    There isnt a specific provision in the wzd (I am not sure of the latest version, though).

  • What is the correct way to format file paths and names in the structapp file?

    I am trying to create a structured application to export fm files as xml, and probably read the xml back to fm.
    In the structured application file (structapp), I need to specify the locations of the various files (DTD, read/write, template, etc). I would like to place these files on a shared server so others can use the same structapp file (that is, a cop of it). What is the correct way to format the file paths and names? Can folders folder names and file names have spaces in them? I tried the following, for example:
    \\serverName\shareName\folder 1\folder 2\file name.dtd
    I use the same format for the template file and the read/write rules file.
    When I try to save an fm file to xml, FrameMaker says that it cannot read the DTD; however, the resulting xml file appears to be well-formed. The DOCTYPE element in the resulting xml is formatted with forward slashes and spaces replaced with %20.
    I tried using forward slashes and replacing spaces with %20, but then I get an error about reading the read/write rules.
    NOTE: I have another structured application to read xml into fm. This application does not have a DTD file. The template and read/write rules files are specified as above. Except for complaining about a lack of a DTD, the application works fine; it even applies an XSLT in the process. Again, when I DO add a DTD to this latter application, I get the same complaint about not being able to read the DTD.
    I am using fully patched FrameMaker 9 in Windows XP.
    Thanks,
    Van

    Hi Van,
    The XML parser and FrameMaker are not the same thing. The Error Log says which component created which message. The XSL processor is another option that can throw messages. The "\\server\path\some.dtd" syntax in structapps.fm seems to be fine for some tools, as Internet Explorer with XML tools successfully finds the DTD which appears as "//server/path/some.dtd" in the XML. But apparently Xerxes, the XML parser bundled with FrameMaker, does not like this notation.
    If you have a path with a drive letter, "H:\path\some.dtd", FrameMaker turns that into "file:///H:/path/some.dtd". It seems, Xerces would like to see "file:/" in front of absolute paths.
    This is what I have in structapps.fm:
    Template: \\server\path\projecttemplate.fm
    DTD: some.dtd
    Read/write rules: \\server\path\projectrules.txt
    DOCTYPE: …
    Entity locations
      Entity search paths
        1: \\server\path\
    In the structapps.fm I have the DTD without path information. The resulting XML (without XSL postprocessing) then contains just the file name with a relative path back to the book folder (when saving a book as XML). It therefore requires the DTD to be available at this place. I handle this using an event script that fires for NotePreSaveXml and copies the DTD to the folder of the original document.
    As I always use XSL postprocessing and using XSLT1 it is not possible to have the doctype-system as a parameter I have this in my XSL stylesheet:
    <xsl:output doctype-system="some.dtd" />
    For the resulting XML the DTD is expected to be in the same folder as the XML file. This is handled by the same event script as above, it therefore copies the DTD to the source and the target folder.
    Bottom line: If you want/have to use UNC paths, you have to do some programming to work around a FrameMaker bug.
    - Michael

  • What is the correct way to add styling to drag-and-drop created calendars?

    I have a working instance of a rich client calendar. I generated the view with the required fields (start, stop, provider, ...), put it into the App Module, and dragged it onto a JSF page to create a calendar.
    Next I created an activityScope object in a class called CalendarBean (no inheritance)
    Class CalendarBean()
    private HashMap<Set<String>, InstanceStyles> activityColorMap;
    +..+
    +public CalendarBean() {+
    super();
    activityColorMap = new HashMap<Set<String>, InstanceStyles>();
    HashSet setEd = new HashSet<String>();
    HashSet setLen = new HashSet<String>();
    setEd.add("Work");
    setLen.add("Home");
    activityColorMap.put(setEd, CalendarActivityRamp.getActivityRamp(CalendarActivityRamp.RampKey.ORANGE));
    activityColorMap.put(setLen, CalendarActivityRamp.getActivityRamp(CalendarActivityRamp.RampKey.RED));
    +}+
    +}+
    Next, I linked this up as a backing bean and associated the ActivityStyles of CalendarBean to it:
    +#{backingBeanScope.calendarBean.activityColorMap}+
    I populated some records in the database with properties "Work" and "Ed', but they show default blue.
    As I understand it, I need to do something with the getTags() method of the underlying CalendarActivity class, but I'm not quite sure how to do that.
    Took a stab at creating a class, CalendarActivityBean, that extended CalendarActivity, and pointed all the CalendarActivity references I had to the new class, but it didn't seem to fire (in debug), and I got into trouble, when inserting records, with
    public void calendarActivityListener(CalendarActivityEvent calendarActivityEvent) {
    currActivity = (CalendarActivityBean) calendarActivityEvent.getCalendarActivity();
    being an illegal cast
    What is the correct way to add provider-based styling to drag-and-drop create calendars?
    Ed Schechter

    A colleague of mine was kind enough to solve this:
    The calendar has ActivityStyles property = #{calendarBean.activityStyles}
    CalendarBean looks something like this:
    package com.hub.appointmentscheduler.ui.schedule;
    import java.util.HashMap;
    import java.util.HashSet;
    import java.util.Set;
    import oracle.adf.view.rich.util.CalendarActivityRamp;
    import oracle.adf.view.rich.util.InstanceStyles;
    +public class CalendarBean {+
    private HashMap activityStyles;
    private String dummy;
    +public CalendarBean() {+
    +// Define colors+
    activityStyles = new HashMap<Set<String>, InstanceStyles>();
    HashSet setPending = new HashSet<String>();
    HashSet setArrived = new HashSet<String>();
    HashSet setApproved = new HashSet<String>();
    HashSet setCompleted = new HashSet<String>();
    setApproved.add("APPROVED");
    setPending.add("PENDING");
    setArrived.add("ARRIVED");
    setCompleted.add("COMPLETED");
    activityStyles.put(setApproved, CalendarActivityRamp.getActivityRamp(CalendarActivityRamp.RampKey.GREEN));
    activityStyles.put(setPending, CalendarActivityRamp.getActivityRamp(CalendarActivityRamp.RampKey.ORANGE));
    activityStyles.put(setArrived, CalendarActivityRamp.getActivityRamp(CalendarActivityRamp.RampKey.PLUM));
    activityStyles.put(setCompleted, CalendarActivityRamp.getActivityRamp(CalendarActivityRamp.RampKey.LAVENDAR));
    +}+
    +public void setactivityStyles(HashMap activityStyles) {+
    this.activityStyles = activityStyles;
    +}+
    +public HashMap getactivityStyles() {+
    return activityStyles;
    +}+
    +}+
    Now, go into the Bindings tab on the calendar page, double click the calendar binding, and specify the column you've defined as the calendar's Provider in the Tags dropdown.
    Should show colors.

  • What is the best way to digitise some work manuals onto my iPad?

    What is the best way to digitise some work manuals onto my iPad? Thanks in advance.

    I honestly don't know if there's an app out there that can handle documents that large.
    Adobe has a free PDF app but i'm not sure if it allows authoring. And taking 200 separate scans and getting them put together into one book may require more resources than the iPad has.
    The ipads only have so much computing power and RAM, so if I were doing it I'd see if the place that scans them will sort them by chapters/topics of your manual.  So say each manual is 10 20 page sections (or however it breaks out)
    There are a lot of free pdf files on various sites (even the apple site has manuals for their stuff). Download some of those and try to open them on your iPad. See where the upper limit is of what your iPad will handle. Then use that as a guide to how you have the copy place break them up.

  • What is the correct way to create links to my website?

    Hi
    My site is finally finished and I am now looking to list it on various directories on the internet to generate links to my site.
    When my site opens in a browser it shows up as http://ateccomputerservices.co.uk
    I know this question has been asked many times on the internet but what is the correct way to post my link?
    I know I should be consistent and use www or not on every link but none of the articles tell me whether I should use http:// or not when linking.
    So for example, should I use...........
    http://ateccomputerservices.co.uk
    or
    http://www.ateccomputerservices.co.uk
    or
    ateccomputerservices.co.uk
    or
    www.ateccomputerservices.co.uk
    and should I put /index at the end?
    Once I've decided on which link to use should I redirect all the other addresses to the main one?
    I'm pretty new to web design so I need some advice from some seasoned experts
    Thanks for taking the time to read my questions!

    When you browse to http://ateccomputerservices.co.uk and to http://www.ateccomputerservices.co.uk do you get the same page?  Most hosts will automatically create a CNAME record for both 'www.example.tld' and 'example.tld' when the hosting account is created, but not all do.  If that second CNAME record is not created, then you must always use the "www" prefix.
    If the reference to your site is a text reference only, then you could just use 'www.ateccomputerservices.co.uk', but if it's a link you should always make the LINK part (the HTML href attribute's value part) as a fully qualified URL, i.e., 'http://www,ateccomputerservices.co.uk' or 'http://ateccomputerservices.co.uk':
    <p>Click <a href="http://ateccomputerservices.co.uk">here</a> to link to my site .</p>
    When a browser requests that domain from the server, the server will fetch the first file it finds with a 'default filename' (usually 'index.html' or 'index.php' or 'home.html' or...) and upload that to the browser, so there is no need to further specify the filename - the default is when no filename is given.
    Once I've decided on which link to use should I redirect all the other addresses to the main one?
    I'm not sure what you are asking here....
    I'm pretty new to web design so I need some advice from some seasoned experts
    In the immortal words of comedian Myron Cohen, "everybody gotta be somewhere".

  • 1.4.2 - What is the correct way to format output in the java.io.PrintStream

    With Java 1.4.2:
    What is the correct way to format output in the java.io.PrintStream?
    The following is incorrect, even though it is still used in the The JavaTM Tutorial at: http://java.sun.com/docs/books/tutorial/essential/
    System.out.formatThis returns "cannot resolve the method 'format'"
    Any detailed suggestions or information is greatly appreciated.

    The following is incorrect, even though it is still
    used in the The JavaTM Tutorial at:
    http://java.sun.com/docs/books/tutorial/essential/
    The whole format thing has been introduced in 1.5. The tutorial also states it's been "updated to 1.5.".
    That's all I've got to say for I don't know how you can format a PrintWriter, let alone a PrintStream, prior to 1.5. I'm not really sure there is any way. Any "legacy way", that is. There almost certainly are third-party API which achieve similar results.

  • What is the correct way to upgrade 5.0.4 to 5.1 Universal?

    I just received Final Cut Studio Universal, and I have Final Cut Pro 5.0.4 installed what is the correct way to upgrade all the Final Cut Studio applications? Do install over or delete each application and then reinstall?
    As always thanks in advance for reading and replying to my Post,
    Sebastian

    WHEN I do it, I'm going to archive what's necessary and desirable to keep, erase my hard drive, reinstall Tiger, do the upgrades, then install 5.1 clean and do the upgrades.
    Might sound like overkill, but I really love a clean, fast machine and nothing does it better!

  • What's the best way to handle new versions of software?

    So we have an Application setup for Adobe Reader (just using Reader as a general example) which is part of our Task Sequence.  When Adobe releases a new version of Reader, what's the best way to handle getting the new version into our SCCM setup.
    I know I can create a new application and do it all over and select the new file, but can I simply replace the files that the application is pointing to and then somehow tell it to update the DPs with the new files?  I'd rather not have to create new
    applications every time if I don't have to.
    Thanks.

    I think continue the way you are doing right now by creating a new application each time there is a version change. Its a clean way to do and this helps with Application life cycle mgmt aswell where you keep track of versions across the environments and
    eventually retire an application. Specially where no changes are made without a change control. This is completely process specific and may not be applicable.
    i do agree with above posted comments about using supercedence option.
    However most of the apps comes with upgrade capabilities from previous versions. So you can upgrade existing version with new one if you do not wish to use supercedence. 
    Thanks 

  • What is the correct way to charge mac air battery?

    what is the correct way to charge macbook air battery? mine is a 2011 mac air

    Apple - Batteries - Notebooks

  • What is the best way to handle input parameter

    When writing sub-vi's, what is the best way to handle input parameter range checking? On the front panel I can choose to have numeric values coerced to be within range, but this does not affect constants or controls wired to the vi when used as a sub-vi. I can build range checking into the vi, but this can result in a cluttered looking vi. Do you have any suggestions.

    As you discovered, the Range and Coercion properties of controls do not work when used in sub-vis.
    Your best option is to go ahead and build your range checking into your sub-vis. If it�s something you will be doing a lot, just make your range checking a sub-vi and drop it where needed. This will keep the clutter to a minimum. You may end up with more than one range checking VI if you need different functionality, but this will still make less clutter and easier re-use.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

  • Sapinst - what is the correct way to startup sapinst

    I am starting install of NW04 on unix. The install manual states that once env paramters are set then do the following:
    cd /SAP_MASTER_DVD/IM2/SAPINST/UNIX/SUN...
    then run ./sapinst
    however run I run it it just waits.....
    I then go back in another session and run startInstGui.sh
    and the sapinst install screen successfully appears?
    Is this the correct way to run the install?
    What is the correct way to run sapinst?
    Thank
    John Ryan

    Figured it out...
    sudo su root not - root
    and it works

  • What is the correct way to call older version of Adober Reader?

    What is the correct way to call older version of Adober Reader? Specifically version 8? Acrobar Reader 8 or Adober Reader 8? Is is necessary to include "Reader"? We are creating a form and are adding instructions that it works with version 8 and newer. We want to make sure it is worded correctly!
    Thanks!
    Danielle

    When you "Save as" and you select the "compatibility with" for older versions, the document will be compatible with whatever version you choose, be it 4, 5, 6, 7, 8, or higher. If you want to "test it", you'll need a computer with Reader 8 installed, but I've never seen the "Save as" make something that was incompatible with the version it was saving for.

  • What is the right way to handle events?

    What is the right way to handle events? If I start doing stuff in the AWT event thread (particulaly things that create their own events) should I be starting a new thread?
    A link to a good book or reference source will do
    thanks in advance

    http://java.sun.com/docs/books/tutorial/uiswing/events/

  • What's the correct way to set up an external style playing keyboard

    Hi
    what's the correct way to set up an external style playing keyboard?
    i want the keyboard to use the Logic's voices, and also to record the midi that is being inputed.
    I can do it on One Channel, but when I selct multiple channels, all the channels seem to play all of the input data!!!
    anybody??

    Check the formatting. It need to be formatted as Mac OS Extended (journaled). This is also known as HFS+.
    FAT32 and NTFS formatting will not work with iMovie.
    If necessary, you can reformat using Disk Utility.
    Make one large partition. No need for multiple partitions.
    Do moves or copies to the external drive through iMovie as detailed in iMovie Help. If you move Events in the Finder, they may become unlinked from the projects that use them.

Maybe you are looking for

  • IMovie Text Options

    I am working on a new macbook at work, and am starting my first movie (iMovie 11, I guess).  I have inserted a Title slide into my movie, and when I go to adjust the text, it won't let me into any font (or other) options.  It'll show me what font it

  • Where can I find a reliable link for firefox 4 download?

    Every link I find for firefox 4 ends up being 8 or above , I need a dependable link for firefox 4

  • After Flashback database can I use my backups?

    I performed a flashback database and then opened the database with alter database open resetlogs; Now when I try the following command in rman I get this message: RMAN> list backup 2> ; new incarnation of database registered in recovery catalog start

  • Fonts on help screen

    Hi, I know this sounds very odd, but suddenly the font on the Dreamweaver 8 help screens has gotten so small I can hardly read them! I'd say they're about 6 pt. The index on the left side of the help screen is fine, it's just the body of the text on

  • Can't download to Aperture 3 or iPhoto 11.

    Things were working perfectly until yesterday. I was able to plug in the camera and have either Aperture (checked Prefs so that it would open and download to Aperture). I tried changing the Pref to download using iPhoto. Neither worked. The SD card w