April 2009 Entries

WCF and LINQ to SQL (Part 4 – Updates)

If you’ve read parts 1, 2 and indeed 3 you’ll know we’ve covered the CRD of CRUD, today we will cover the ‘U’ – updates! Updates are more complex than the other scenario’s we’ve covered so far, but not unmanageable. Also – in fairness this is a very simple update, more complex updates will require more thought (duh!) but this should be a good starting point. Let’s get to it! We’ll start on familiar ground – updating the interface, adding an ‘UpdateCar’ method: [OperationContract] void UpdateCar(Car ......

WCF and LINQ to SQL (Part 3 (Deletes))

If you’ve read parts 1 and 2 you’ll know we’ve covered the CR of CRUD, today we will cover the ‘D’ – deletions. We’ll need to update our interface to actually provide this functionality: [ServiceContract] public interface ICarsService { [OperationContract] Car GetCar(int id); [OperationContract] void SubmitCar(Car car); [OperationContract] void DeleteCar(int id); } I’ve decided to delete the car via the identifier we created initially, though there is nothing to stop us using a ‘Car’ instance. Anyhews, ......