How do I relate tables in Azure Mobile Service - Javascript Backend - angularjs

On the azure page I can create my tables but there are only 4 data types and no option to create or relate the tables using foreign keys and SQL.
What I want to do is have a user and contact table with userId in contact table as a foreign key.
I am using apache cordova and angularJs on the front end in visual studio. I have already added the mobile service to my project.

Mobile Services does not directly support relationships in the backend, but you can customize the data using server scripts and the mssql object. Alternatively, you can create database views that have relationships between tables.
For an example of mapping relationships using database views, please see my post in this forum thread: Best Practice For Syncing Related Tables in Offline Mode.
For more information on managing the database directly, see this article: Scale mobile services backed by Azure SQL Database.

Related

Create migration file while creating table in Laravel Voyager

I am using Voyager framework for Laravel. Wherenever I create table from Database Manager its creating table but its not creating any migration file. And its not good user interface who works on git repository(share the application's database schema). Everyone in the group has to create table in backend and have to work. This is not good.
but It creates table in database(phpmyadmin)
and we have option to create Model(while creating table)
Any solution? need quick response
Unfortunately, Laravel Voyager doesn't make migrations for user tables.
There are two workarounds.
Laravel Migrations Generator
Use this dev package to generate the migrations for the given tables. Availabe on GitHub at: https://github.com/Xethron/migrations-generator. View the documentation to see how to generate the migrations for the specific tables.
However, the collaborators will have to create the BREADs for them.
Copying the database
While sharing the database, the laravel voyager config tables that have all the changes and specs will be available on all the collaborator accounts.
Laravel voyager saves all its configurations in tables. Hence removing the need to generate migrations. Porting the whole DB works for most of my projects since I work on most apps alone.

Cross join databases

Project: RecipeRolodex
Mission: Create database (Entity Framework, data-first) and ASP.NET MVC5 Application to create and manage catalog of recipes.
Tech: SQL Server 2012, Visual Studio Enterprise 2015
Database diagram - Recipes
https://sqldbm.com/Project/SQLServer/Share/lE7q9CWGgGiR0I-o8mWAAA
My database has been created, the application can read/write data out of it. I'm developing the process to actually create the recipes (the scaffolding isn't sufficient).
I know that the recipes table should contain a foreign key relationship to a UserID in the AspNetUsers table.
I allowed the application to build a new database for ASP.NET Identity.
How would I go about accessing Recipes based off of UserID?
I have had to deal with an issue like this before. I would suggest moving the data to ONE database - really helps with keeping the database relational, which is what makes SQL-server a good database. Also will help with over all speed when dealing with JOINING tables.

Use Entity Framework automatic migrations only on one SQL Server schema

I've been tasked to create a web API for a vendors database that we host on-site ourselves. What we want to do is create EF data models/db sets for some of the existing vendor tables, but we also want to create a special schema for our custom tables that store the relationships between the vendor data and our other applications.
The thing I've been wondering about is how can we use automatic migrations and database initialization just for our special schema and let the vendor application manage its tables separately on its own. Is this possible?

Existing tables do not get linked to the Azure Mobile App service

I'm using Azure Mobile App service for the first time. I have an existing database which is hosted by Azure. I used this database when creating the App service. I followed this tutorial here which demonstrates how to use existing database. I first created the schema with the same name as the App service and then transferred all tables to that schema. Now I'm trying to access these tables from the Azure portal. I went to Easy Tables tab and created the tables with the same name as in my database and when I click into the table, I don't see any records that are already in the database. The new table that was created, doesn't have the same fields as the tables in my database. They have the following fields : "ID", "CREATEDAT", "UPDATEDAT", "VERSION", "DELETED". The tutorial I followed seemed to have worked for many people. I have the primary keys in my tables with the name "id".
Can anyone give me an idea what the problem might be?
The problem is that you followed a tutorial meant for Azure Mobile Services and applied it to Azure App Service - these are two totally different things. Probably most importantly, your tables are not in the [dbo] schema, which is where Easy Tables expects them to be (unless you configure the app service otherwise). In addition, Mobile Services used double-underscore before the system properties, whereas App Service does not.
If you want to use your existing database, follow the instructions in my App Service Mobile Apps tutorial here: https://shellmonger.com/2016/05/11/30-days-of-zumo-v2-azure-mobile-apps-day-19-asp-net-table-controllers/

Using a new / separate database for forms authentication

Does anyone have a view on whether to use a new separate database for forms authentication users, or is it ok to mix it with your application database?
I could see separation being useful if multiple applications/databases were sharing user authentication, but in my case I have one website/database, and intended to just add the tables/views/sps created by aspnet_regsql.exe to my current application database.
Any views/opinions welcomed. Thank you.
You can mix that db with your database BUT you should not make any changes to the default database tables if you want to use asp.net built in classes that use that database , It means you can only add your tables to that database !
That is OK to have a single Database from which the Forms are to be authenticated. Since the SQL server is a very secure one there will be no problem in having a single database.
But If you want to setup Your custom database for Authentication then Refer the following Links
Using Forms Authentication with a customer database
forms authentication with sql server 2008 database questions

Resources