Ebsan
Ebsan

Reputation: 767

Stored procedures in Azure Mobile Service with .NET backend?

So there's documentation on how to call stored procedures from an Azure Mobile Service with a Javascript backend found here. But I don't see any documentation for the .NET backend. In that article it says that the .NET backend is has a completely different architecture.

My question is: How are stored procedures handled in the .NET backend? Would I create ADO.NET connections to the database and expose a call to the stored procedure via a custom API method? Something like a "GetStoredProcedure" controller method? Or do the APIs act like stored procedures?

Upvotes: 0

Views: 1166

Answers (2)

Ebsan
Ebsan

Reputation: 767

Glenn Gailey of the Microsoft Azure team wrote up a very useful blog post for this question HERE. It helped me create and call a stored procedure from the MobileService.

Upvotes: 0

SeanCocteau
SeanCocteau

Reputation: 1876

By .NET backend they are talking about a custom mobile service, which effectively in no different in terms of structure of a WebService using ADO.NET. You would expose methods of the API to perform whatever functions you need to expose.

Typically, such methods would be GetCustomers, SaveCustomer, DeleteCustomer, etc. and would provide an appropriate implementation to satisfy that requirement. For example, GetCustomers may call a stored procedure that returns all the customers but could be any other SQL related operation. Typically there would be no generic methods such as 'GetStoredProcedure' as for me, this isn't a recommended approach. For instance you may have business logic / data rules that would be applied rather than the consumer (your mobile service) from interacting with the backend DB directly - ultimately that's a trade-off of n-tiered systems, which has loads of discussion knocking around on the web, but just think of it in terms of whether you want to expose that kind of access to the DB...

Finally, on "do the APIs act like stored procedures", well this is rather subjective. In terms of pure SQL they are chunks of T-SQL that can be called through a single entry point - so in those terms, they kinda do. In more practical terms and more related to your overall question, a method exposed through a WebService or other .NET enabled endpoint, then you're only limited by the confines of .NET, so this could be calling and serving an explicit stored procedure returning strongly typed objects, it could be a file / blob operation or whatever technology operation you want (and are capable) to perform!

HTH

Upvotes: 1

Related Questions