private void DataPortal_Fetch(PKCriteria criteria) { Database.LogInfo("Territory.DataPortal_Fetch", GetHashCode()); try { using (SqlConnection cn = Database.Northwind_SqlConnection) { ApplicationContext.LocalContext["cn"] = cn; using (SqlCommand cm = cn.CreateCommand()) { cm.CommandType = CommandType.StoredProcedure; cm.CommandText = "getTerritory"; cm.Parameters.AddWithValue("@TerritoryID", criteria.TerritoryID); using (SafeDataReader dr = new SafeDataReader(cm.ExecuteReader())) { if (!dr.Read()) { _ErrorMessage = "No Record Found"; return; } ReadData(dr); // load child objects dr.NextResult(); _TerritoryEmployeeTerritories = TerritoryEmployeeTerritories.Get(dr); } } // removing of item only needed for local data portal if (ApplicationContext.ExecutionLocation == ApplicationContext.ExecutionLocations.Client) { ApplicationContext.LocalContext.Remove("cn"); } } } catch (Exception ex) { Database.LogException("Territory.DataPortal_Fetch", ex); _ErrorMessage = ex.Message; throw new DbCslaException("Territory.DataPortal_Fetch", ex); } }
public TerritoryEmployeeTerritoriesPropertyDescriptor(TerritoryEmployeeTerritories collection, int index) : base(collection, index) { ; }