Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8302231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:14:07+00:00 2026-06-08T17:14:07+00:00

This is my entity class: public partial class NerdDinnerEntities : ObjectContext { public NerdDinnerEntities(string

  • 0

This is my entity class:

public partial class NerdDinnerEntities : ObjectContext
{
    public NerdDinnerEntities(string connectionString)
        : base(connectionString, "NerdDinnerEntities")
    {
        try
        {
            ObjectContext oc = new ObjectContext(connectionString);

           oc.Connection.ChangeDatabase("NERDDINNER1");
           oc.AcceptAllChanges();
            this.ContextOptions.LazyLoadingEnabled = true;
            OnContextCreated();
        }
        catch (Exception ex) { }
    }

    partial void OnContextCreated();

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public ObjectSet<Dinner> Dinners
    {
        get
        {
            if ((_Dinners == null))
            {
                _Dinners = base.CreateObjectSet<Dinner>("Dinners");
            }
            return _Dinners;
        }
    }
    private ObjectSet<Dinner> _Dinners;

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public ObjectSet<RSVP> RSVPs
    {
        get
        {
            if ((_RSVPs == null))
            {
                _RSVPs = base.CreateObjectSet<RSVP>("RSVPs");
            }
            return _RSVPs;
        }
    }

    private ObjectSet<RSVP> _RSVPs;

    /// <summary>
    /// No Metadata Documentation available.
    /// </summary>
    public ObjectSet<sysdiagram> sysdiagrams
    {
        get
        {
            if ((_sysdiagrams == null))
            {
                _sysdiagrams = base.CreateObjectSet<sysdiagram>("sysdiagrams");
            }
            return _sysdiagrams;
        }
    }

    private ObjectSet<sysdiagram> _sysdiagrams;

    /// <summary>
    /// Deprecated Method for adding a new object to the Dinners EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
    /// </summary>
    public void AddToDinners(Dinner dinner)
    {
        base.AddObject("Dinners", dinner);
    }

    /// <summary>
    /// Deprecated Method for adding a new object to the RSVPs EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
    /// </summary>
    public void AddToRSVPs(RSVP rSVP)
    {
        base.AddObject("RSVPs", rSVP);
    }

    /// <summary>
    /// Deprecated Method for adding a new object to the sysdiagrams EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
    /// </summary>
    public void AddTosysdiagrams(sysdiagram sysdiagram)
    {
        base.AddObject("sysdiagrams", sysdiagram);
    }
}

and these is my web.config file as

<add name="NerdDinnerEntities" connectionString="metadata=res://*/Models.NerdDinner.csdl|res://*/Models.NerdDinner.ssdl|res://*/Models.NerdDinner.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=@;Database=NERDDINNER;User ID=@;Password=@@@;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClients" />

and i am getting error:

Specified method is not supported

in this line:

oc.Connection.ChangeDatabase("NERDDINNER1");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:14:09+00:00Added an answer on June 8, 2026 at 5:14 pm

    If you look up the docs at MSDN you will see that the method literally is not supported. It must be a placeholder for future improvements or something.

    To expand for those who do want to change the database at runtime:

    1.Create an entry in your settings to use in-place of the default in the app.config. Pull out the specifics, like Username, password, catalog name (database name), server etc into other settings entries.

    <Setting Name="EntityConnectionString2" Type="System.String" Scope="Application">
      <Value Profile="(Default)">metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source={0};initial catalog={1};persist security info=True;user id={2};password={3};encrypt=True;trustservercertificate=True;multipleactiveresultsets=True;App=EntityFramework"</Value>
    </Setting>
    

    Please note the {0}..{3} entries & that this connection string is not the whole configuration/connectionStrings/add entry in the app.config

    2.Use one of the overloaded constructors for the EF Database that accepts a connection string.

    var settings = Properties.Settings.Default;  
    string constring = string.Format(settings.EntityConnectionString2, settings.Server, settings.Database, settings.User, settings.Password);
    NerdDinnerEntities db = new NerdDinnerEntities (constring);  
    

    3.To change at runtime you can create a different object in the same manner with a different catalog name, or dispose and recreate the db object with a different catalog name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What does this sort of method signature mean public partial class Entities : Entity.ObjectContext<Entities>
I have silverlight usercontrol. This contains Service Entity object. see below public partial class
model public partial class TblMusteriler { public TblMusteriler() { this.TblSayaclar = new HashSet<TblSayaclar>(); }
mI've this entity class: @Entity public class User implements Serializable { @Id @GeneratedValue(strategy=GenerationType.AUTO) private
I have a Customer class defined like this: @Entity public class Customer { //...
Let's say I have this entity (for Hibernate): @Entity public class Person { @Id
If I have this entity: @Entity class Pet { @Id long id; public enum
Imagine a class like this: public class MyEntity : Entity { public virtual States
This is an extract of the JPA entities schema @Entity @Table(name=customer) public class Customer
I have this piece of code: @Entity @Table(name = MOVERS) public class MOVers implements

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.