views:

187

answers:

2

I have a Business Logic Layer (BLL) and a Data Access Layer (DAL) that used for WinForms, WebForms, and ASP.NET MVC projects in the past. The objects implement all kinds of interfaces. Now I would like to tackle ADO.NET Data Services.

I am trying something simple like the following, but it's not rendering my service. Am I totally missing something? What do I have add to my BLL that I haven't? Am I too naive to think it'll just "work", but Astoria being quite complex?

public class EmployeeData
    {
        private static EmployeeCollection employees;

        public EmployeeData()
        {
            employees = EmployeeLoaded.GetData();
        }

        public IQueryable<Employee> Employees
        {
            get
            {
                return employees.AsQueryable();
            }
        }
   }
A: 

Your entities need to have their attributes like DataServiceKey setup like the exmple below.

[DataServicesKey("Id")]
public partial class Customer
{
}

And if you are looking to write data using your BLL, your model will need to implement the IUpdatable interface.

dmportella
A: 

You will also need a call to config.SetEntitySetAccessRule in your InitializeService method to enable access to your entity set (Employees).

Vitek Karas MSFT