New Posts New Posts RSS Feed: [SOLVED]Web Example for EF
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

[SOLVED]Web Example for EF

 Post Reply Post Reply
Author
miltonb View Drop Down
Newbie
Newbie
Avatar

Joined: 24-Mar-2008
Location: Australia
Posts: 2
Post Options Post Options   Quote miltonb Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED]Web Example for EF
    Posted: 25-Mar-2008 at 5:34pm
Thanks for your prompt and accurate reply.
 
I used suggestion 2) with
            <edmKey connection="metadata=D:\Projects\ServerModelMC.csdl|D:\Projects\ServerModelMC.ssdl|D:\Projects\ServerModelMC.msl;
provider=System.Data.SqlClient;provider  etc.......
 
I copied the files into the root of the projects folder.
 
The page is not working, I will now press on.
 
Milton
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 25-Mar-2008 at 9:19am
Sorry, we don't have an ASP.NET example yet, and it may be a few more revs before we do.
 
A few things to look at now:
 
1) If you're using "loose" artifact files (the *.csdl, *.msl and *.ssdl files) they should be located in your bin folder, along with the server model assembly. 
 
2) You'll need to tweak the connection string for the EdmKey in the config file so that the metadata points to the bin folder, something like this:
 
connection="metadata=~/bin/MyModel.csdl|~/bin/MyModel.ssdl|~/bin/MyModel.msl; ... <other connection info removed>
 
3) If you're using artifact files embedded in the server assembly, well, first I would say that in EF Beta3 they're more trouble than they're worth so don't bother.  But if you are,  make sure the server assembly is in the bin folder, and change your connection string to something like:
 
connection="metadata=res://MyServerModelAssemblyName;   ... <snipped remainder>
Back to Top
miltonb View Drop Down
Newbie
Newbie
Avatar

Joined: 24-Mar-2008
Location: Australia
Posts: 2
Post Options Post Options   Quote miltonb Quote  Post ReplyReply Direct Link To This Post Posted: 24-Mar-2008 at 6:58pm
Hi,
 
Is there an example (or code) of an asp.net web application using EF?
 
I have used the code below from examples in my asp.net app (without static method) but get the error as below.
 
 
        private void RunQuery00()
        {
            MCDomainModel.Manager aManager = new MCDomainModel.Manager();
            var query = aManager.tciUser;
            foreach (MCDomainModel.tciUser aUser in query)
            {
                TextBox1.Text = aUser.familyName + " " + aUser.givenName + "\r\n";
            }
        }
 
Error appears when get to foreach query: The specified metadata path is not valid. A valid path must be either an existing directory, an existing file with extension '.csdl', '.ssdl', or '.msl', or a URI that identifies an embedded resource.
 
Thanks.
 
Milton


Edited by miltonb - 25-Mar-2008 at 10:08pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down