This project is read-only.

Simple Code Samples

Notice that there is no data context required in any of these samples.

Create and Save a PDO:
Employee employee = new Employee();
employee.LastName = "Doe";
employee.FirstName = "John";

Load a PDO with a LINQ query:
Employee employee = new Employee();
employee.Load(from e in Employee.Table where e.LastName == "Doe" select e);

Load a PDO list with a LINQ query:
PersistableDataObjectList<Customer> owners = 
         Customer.GetList<Customer>(from c in Customer.Table where c.ContactTitle == "Owner" select c);

Create and save a new Employee, selecting the Territory from a TerritoryList:
        private PersistableDataObjectList<Territories> _territoryList;
        public PersistableDataObjectList<Territories> TerritoryList
                if (null == _territoryList)
                    _territoryList = Territories.GetAll();

                return _territoryList;

        public void AddNewEmployee()
            Employee e = new Employee() { FirstName = "Al", LastName = "Capone" };
            EmployeeTerritories et = new EmployeeTerritories();
            et.Territory = (from t in TerritoryList where t.TerritoryDescription == "Chicago" select t).First();


Last edited Dec 1, 2009 at 4:08 AM by chuckc, version 5


No comments yet.