public void Action()
 {
     using (IDataContext dc = _dataContextFactory.CreateInstance())
     {
         var repo = _repositoryFactory.CreateUserRepository();
         // do stuff with repo...
     }
 }
Esempio n. 2
0
    public IQueryable <Building> GetBuildings(int propertyId)
    {
        IQueryable <Building> buildings;

        using (var context = factory.CreateInstance()) {
            var Params = new List <SqlParameter> {
                new SqlParameter("@PropertyId", propertyId)
            };

            buildings = context
                        .ExecuteQuery <Building>(System.Data.CommandType.StoredProcedure, "dbo.Building_List", Params.ToArray <object>())
                        .AsQueryable();
        }
        return(buildings);
    }