Asking for your input. I have created a project athrough ASP.NET - CRUD with EntityFramework
We have to use Azure services for deployment.
This is my setup:
Created Azure SQL database.
Completed the table for the data to be stored (name, age etc.)
Create ASP.NET API and scaffold. Success. Was able to view my data on the localhost.
Created AZURE web app service and publish my API. Checking the url its working so okay.
Completed ASP.NET MVC, called my deployed API app service. Modified controllers, models and views for my webform.
Created AZURE web app service and publish my MVC. So working CRUD, success retrieval of data.
So now working on uploading image.
How will I incorporate the uploading of image for my user(for ex those who will check my project) using blob. Do I need to add the step during my creation of API since I scaffold it? I'm now confused about how I can include my image retrieval from blob storage in my setup or workflow. I just able to work in my crud and still studying for image retrieval.
I have seen tutorials with regards to incorporating blob in asp.net. The problem is that they have only this image upload function in their example. My case is I do want to incorporate it with my CRUD.
Thank you very much for your help.
Do I need to add the step during my creation of API since I scaffold it?
Asp.Net Core's scaffolding won't automatically help you integrate azure blob-related feature code.
If you want to use the relevant code in the auzre blob in the scaffolding, you need to combine the SDK or restapi to implement it yourself.
Related
I am evaluating Xamarin and I am hoping to clarify that I am on the correct path.
We would like to create a Xamarin forms app with offline sync. We are using azure to host the backend database. I have created an Azure web app that uses as Azure SQL database.
I have seen example using easy tables, which seems to create the API’s for you but I cannot find any examples where an Azure SQL database is used.
I have gone to the quick start blade of my azure web app, selected Xamarin.Forms, then chose the backend language of C# and downloaded the project. The project included the TodoItems table as an example. Am I correct in thinking that I need to replace this code with the model of the tables I have in my azure SQL database? And then add the changes back to the web app to expose the tables so that the xamarin forms app can use?
Or am I completely on the wrong track? Should I be using swagger (which I have no experience with) to create the API?
Thanks.
From How to: Define a table controller, you could find that Data Transfer Object (DTO) class that is used to define the table within the SQL database need to inherit from EntityData class. And deriving it from EntityData class is aimed at making it support the system properties. It seems that you have created some tables in your Azure SQL database, if you’d like to expose these existing SQL database tables that does not contain these system properties, please refer to “Using an existing SQL Table” in chapter 3.
My aim is to develop a web app and a mobile app that share data from the same database.
What is the best way to achieve this (using azure)?
I think I should:
Create a Web App from Azure Portal with a SQL Database
Create a Mobile App from Azure Portal with an existing Database (the one I created before)
Then I'll develop my ASP.net MVC project, using Entity Framework to create the db Schema and I'll publish it in Azure.
Finally I'll develope my mobile app (in this case I would like to use Xamarin) and I'll access to the database (created before) using the code for Easy Tables.
Is it right? Or I'm thinking wrong and this isn't the best architecture to share the same database between a web app and a mobile app using Azure?
This should be fine. Keep in mind that the Azure Mobile Apps server will automatically add some system columns to your database tables (createdAt, updatedAt, deleted and version). Also, a limitation of Mobile Apps is that the primary key name must be called id.
If you want to develop the web site and mobile app share the same database, it is a good choice.
Azure Mobile Apps is a plain old ASP.NET application or Node.js application. Easy Tables is simply a projection of data from the Node.js version. If you are using ASP.NET, then you don't get Easy Tables.
That being said, it is relatively easy to add Azure Mobile Apps SDK to an EXISTING web app.
1) Copy the code from App_Start\Startup.MobileApp.cs and Startup.cs from a sample app to your ASP.NET app
2) Ensure all your models inherit from EntityData so that they are "mobile ready". If your models already have an auto-incrementing Id column, then see https://shellmonger.com/2016/05/11/30-days-of-zumo-v2-azure-mobile-apps-day-19-asp-net-table-controllers/ for a workaround
3) Scaffold Azure Mobile Apps Table Controllers for your mobile database table projections.
You can use the same models across both MVC controllers and Mobile controllers. If your app uses AJAX calls for getting data, you can replace those AJAX calls with the JavaScript SDK for Azure Mobile Apps so you don't have to duplicate things.
The main place you are going to have to work on is integration of auth. Most MVC applications use an Identity database because they have grown it from one of the existing MVC templates. You are going to need to implement a custom mobile auth mechanism to re-use the database. You can find information about this on the azure.com HOWTO documentation.
I've been studying Xamarin.Forms with goal of building cross-platform mobile app in VisualStudio2015. I've got a perfectly acceptable public facing web site but native app(s) are what the boss thinks we need.
The current web app hosted on IIS 7.5 uses a separate project(DLL) for database access to an on-premises SQL Server 2008 instance. This VStudio project exposes domain objects to the calling ASP.NET webforms by executing various stored procedures using System.Data.SqlClient.
I know building the mobile native app itself with Xamarin.Forms is one part of the challenge but I am asking here for clarification about how to approach the database requirements:
Do I need to create some sort of web service that provides the same CRUD functions required by my current web site?
Xamarin documentation lists several options for consuming web services and the more I search and read about data access I conclude that a callable web service of some type is going to be required for my eventual native mobile app.
Is this assumption correct?
Yes. You generally want a webservice layer brokering requests between your mobile app (or any remote client) and your DB server. If you already have all your crud operations in a separate library that is utilized by your website, then a webservice would just be another set of endpoints that rely on the same CRUD library.
I want to build an application for web and also for android. The application will have a database, and users should be able to login and perform some actions.
In Symfony2 documentation you can find all the information about how to create a web site, also there is information about how to create a symfony2 REST API.
However it is not clear for me, how to create a symfony2 web site that consumes a symfony2 REST API, and also (as it is a web service) be able to use the same REST API to consume from my android app
Any idea will be really appreciated
I am new using symfony2
Thanks
You can build your REST API easily with FOSRestBundle. There is a nice tutorial on the subject here.
In building your website, you have some options.
You can query the database directly in your controllers.
You can query your REST API in your controllers using cURL.
You can query your REST API in your views use jQuery or just AJAX.
I have a asp.net mvc 4 website. It's database was created using the code-first method. However this website of mine is a blog and i uploaded it to my server. Now i have a few articles and i wanna do some changes - add keywords for example, but this requires changing the model of the articles, if it's local i can easily migrate the new model to the database with the package manager console(VS2012) but how do i do that when it's on my hosting company's server. I didn't find any good results in google. Thank you
I would assume you would just point the connection string that entity framework is using to the database on the remote host rather than your local machine. You're using migrations and I have only used the database initializers (that change the database schema when the model changes), but I can't see it being much different.