none
Can I deploy an EF program without a pre-existing database? RRS feed

  • Question

  • WHAT I HAVE:

    Visual Basic 2010/.NET 4.0 with EF and SQL Express

    MY QUESTION:

    Suppose that I create an entity model (say, model-first) and then create a "prototype" database in order to generate the metadata. Suppose also that my all my model's ObjectContext constructors in the VB code use connection strings that specify databases--be they pre-existing or to-be-created--that are defined by the program/user  (using InitialCatalog and AttachDBFilename). Question: Do I then actually need the "prototype" created by EF when deploying my application? Or can I delete/omit the prototype, having the program rely soley on the metadata files to properly create/open and access databases? It would really be useful if the latter were true, as I tend to write apps designed to let users and the program dynamically create databases from "scratch" (using a pre-defined schema).


    Robert Gustafson







    Monday, October 21, 2013 1:33 PM

Answers

  • The before:"Yes, the metadata and the model are enough".

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, October 29, 2013 10:24 AM
    Moderator

All replies

  • Hello,

    >>a "prototype" database in order to generate the metadata

    Could you please share some codes regarding it?

    >>Or can I delete/omit the prototype, having the program rely soley on the metadata files to properly create/open and access databases?

    Do you mean that you will delete all the entities and just leave an empty model like below?

    If I have misunderstood, please let me know.

    Thanks&Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 23, 2013 9:44 AM
    Moderator
  • No, I mean KEEP the entities and get rid of the .mdf database after the model is used to generate it. I would distribute the metadata files and allow the program/user to create and access databases built on the model; I just wouldn't distribute the .mdf file that was generated from the entities in order to get the metadata files. My basic question is, once the metadata files are generated, is that enough for a program to work with, or must there always be a "prototype" database catalog and file (assuming that the program will create any databases it needs using the model) present?

    Robert Gustafson


    Saturday, October 26, 2013 9:56 PM
  • >>My basic question is, once the metadata files are generated, is that enough for a program to work with, or must there always be a "prototype" database catalog and file (assuming that the program will create any databases it needs using the model) present

    I think if the metadata is suitable for the database created by program, it is yes.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, October 28, 2013 8:43 AM
    Moderator
  • Do you mean "Yes, the metadata and the model are enough", or "Yes, you must have the original 'prototype' database file""? Remember that all the databases that my program creates (at application run-time) will be be based on the same model.

    Robert Gustafson

    Monday, October 28, 2013 7:34 PM
  • The before:"Yes, the metadata and the model are enough".

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, October 29, 2013 10:24 AM
    Moderator
  • Thank you.

    Robert Gustafson

    Wednesday, October 30, 2013 12:28 AM