Question: I was successfully able to save data to the Sql Server database, using an Entity Data Model, as follows:

```
MEDIANEntities db = new MEDIANEntities();
tblCountry objTable = new tblCountry();
objTable.Name= txtName.Text.Trim();
objTable.CreatedDate = System.DateTime.Now;
db.AddTotblCountries(objTable);
db.SaveChanges();

```

The idea now, is to use the EDM in a class library, so that it can be consumed in other projects (a tier architecture basically). I have created a Class library - 'MedianContext' and then created a new edmx file inside it - 'MedianModel'. And then another class library - 'MedianDAL'. Added the reference of MedianContext to it.

Unable to access properties of objcontext and tb. How can I proceed further.
If it helps, when adding the reference to MedianDAL, the MediaContext.dll was inside the debug folder instead of Release folder, as seen in many examples.

![enter image description here](https://i.stack.imgur.com/b6Efi.jpg)

Answer: 
Have you tried it with `Linq2Entities`? 

e.g.:

```
try
{
    using (var medianEntities = new MedianModel.MEDIANEntities())
    {
          //Do any LinqToEntity-Expressions
    }
}
catch(Exception)
{ 
    //ErrorHandling
}

```

That works for me.
I also have my .edmx files in a different project and just added a reference to this. 

**Edit:**

Of course you have to put this code into a method-body.

 Here is a simple example:

```
public List<Map> GetAllMaps()
{
    var Maps = new System.Collections.Generic.List<Map>();

    try
    {
         using (var mapEntities = new Model.MapEntities())
         {
              var MyMaps= (from M in mapEntities.Maps
                               orderby M.Description
                               select M.MapID, M.Description);

             foreach (var Map in MyMaps)
             {
                   Maps.Add(Map);
             }
          }
          return Maps;
      }
      catch (System.Exception Exc)
      {
          Log.Err(string.Format("Error: {0}", Exc));
          throw new System.Exception(Exc.ToString());
      }
}

```
Probably because you are trying to access the properties while in the context of the class ? Create constructor for this class and access the properties from there:

```
public Test
{
tb....
}

```