Ravi Solanki
Ravi Solanki

Reputation: 87

Azure Mobile Services with existing database + table controller

I have created Azure Mobile Service using Azure portal and selected a existing database.

Now I have few questions:

  1. Whenever I'll run the application, database gets cleared as ClearDatabaseSchemaIfModelChanges has configured for Database Initializer in WebApiConfig. Can I use database first approach for Entity Framework?
  2. My existing database has default schema is dbo but it will create a new schema for all tables same as service name. How to overcome this scenario?
  3. Finally, TableController is tightly bind to a table. But output requires in my case is bit complex as I require data from multiple table using join each other. And I also wants to add some logic before giving return the result.
  4. And a tightly bound table also requires some common columns like CreatedAt, UpdatedAt, Id, Deleted as it inherit from EntityData class. But In my existing tables, columns are not there.

Help me out !!

Upvotes: 0

Views: 730

Answers (2)

JuneT
JuneT

Reputation: 7860

first, you should be using Azure Mobile Apps instead of Azure Mobile Services.

You can follow what Alexandr has mentioned, or you can stick with using Mobile App by extending your existing tables to add the required columns (especially if you want to do sync).

The TableControllers are just plain WebAPI controllers, you can certainly extend it.

Have a look at this link for a more guided step on how reuse an existing database.

Upvotes: 1

Alex Belotserkovskiy
Alex Belotserkovskiy

Reputation: 4062

You can do the following:

1) Create the custom API for your operations (that are not so tightly connected with the HTTP verbs and the table)

2) Manipulate the DB manually - it is just a SQL Azure database that can be managed by SQL Servre Management Studio, Visual Studio or queries. So, shortly, if you need the flexibility of doing what you need with the database, you can do it, but Mobile Services is a service, so there are some limitations.

Hope that helps. If not, please elaborate the issue.

Upvotes: 2

Related Questions