I want to create an application with JayData + WCF/RIA Services but i need to detect the changes in the client side (Javascript) entities to put the business logic on the server side.
E.g: if i change a name of a customer, i want to do some validation before i update it on the server.
Is there anyway to do something like this?
[Insert]
public void InsertCustomer(Customer customer)
{
// Some validation before insert
}
[Update]
public void UpdateCustomer(Customer customer)
{
// Some validation before update
}
[Delete]
public void DeleteCustomer(Customer customer)
{
// Some validation before delete
}
To address this securely you need to do it on the server side (and not in JayData) and you need to implement authentication either on .NET way or on you own Then have a check in the onupdate server side method and make something like this:
C# code:
[Insert]
public void InsertCustomer(Customer customer) {
if (! customer.LoginName == Thread.CurrentPrincipal.Identity.Name ) {
throw new SomeValidtionException()
}
}
Is this what you need?