I am looking for an option to have a free database on Azure.
From the article I see that there is an option to have free DB on Azure. But it works for standard ASP.NET MVC. How can I achieve this in ASP.NET Core ?
Or, maybe Azure provides some free/very cheap DB?
there used to be a free SKU for SQL server, but's no longer available. the only free db option you have atm is ClearDB's hosted MySQL (Mercury tier). if you have the correct DB drivers or framework then you can do this easily : https://docs.asp.net/en/latest/data/index.html
Hope this helps
Once you have created the free database you can use it for any purpose you desire.
You can get the connection string and add allowed IP addresses through the Azure portal.
During development I am using SQLLite, which is free and works like a charm. It is perfect for small applications. Using it with Entity Framework however might cause some issues when database changes are introduced later. But once you switch to production you can just use a different database provider.
Related
I am trying to set up integration testing between the repository and database for a .NET Framework app, which has already been built. I have been trying to find a way to setup and seed a test database or in memory database that I could use to run some tests against, but don't see much in terms of .NET Framework apps.
I have seen that there is a Microsoft.EntityFrameworkCore.InMemory library that accomplishes what I need, but it is only available for .NET Core projects running version 6.0. I have also found little to no similar mention of this being possible on a .NET Framework Project, but imagine that there has to be a way.
My work on this legacy app is my first foray into the .NET world, so I may be misunderstanding things from my research on this topic. Is it possible to set up a test/in memory database for integration testing a .NET Framework app? If so, what are the best practices for doing so?
If you really want to test a pure SQL database, my advice would be to setup a local MSSQL Server for testing your application and its integration with the database. I don't know what kind of project you have, but assuming it is a ASP.NET project (Web API p.e) you should already have well defined Models which work like the building blocks of the tables you will use on your database. EF Core essentially maps those models as tables in the database.
Define a new connection to a local MSSQL Server
1. Define the service on Startup.cs
using Microsoft.EntityFrameworkCore;
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<DatabaseContext>(opt => opt
.UseSqlServer(_config.GetConnectionString("Name"), builder =>
{
builder.EnableRetryOnFailure(5, TimeSpan.FromSeconds(10), null);
}));
}
The EnableRetryOnFailure will make sure your application retries a connection to the database server in case of a connection error.
2. Define a ConnectionString
Go to appsettings.json and add
"ConnectionStrings": {
"Name": "Server=(localdb)\\MSSQLLocalDB;Database=myDb;Trusted_Connection=true"
}
This example uses Windows authentication, but you can use SQL Server Authentication
3. Install MSSQL Server Management Studio
It helps a lot for visualizing your database tables
Entitiy Framework in-memory is available for .NET 5.0. My advice to use a local database instance with MSSQL is Microsoft's own recommendation, as mentioned in their website
The EF in-memory database often behaves differently than relational databases. Only use the EF in-memory database after fully understanding the issues and trade-offs involved, as discussed in Testing code that uses EF Core.
I'm trying to use Entity Framework Core with SQL Server (not SQLite) in a Xamarin forms app but I just can't figure it out! All tutorials explain how to use EF Core with sqlite! Are there any clear documentation or tutorials?
About connect to a Remote DataBase in Xamarin.Forms, I find one article that you can take a look:
https://xamarinhelp.com/connecting-remote-database-xamarin-forms/
You may be wondering why you couldn’t just connect directly to a database from your mobile app? The main reasons are:
Security
You don’t want your mobile client apps to have a database connection string with a username and password in it. It opens your database up to anyone. You can create a user with read only permissions and only allow access to certain tables, but they could still see all data in these tables. On an API, you can implement additional security checks and have authentication based on OAuth or an existing user management system.
Performance
Database connections weren’t designed to go over high latency connections. It is likely your database connection would keep dropping, forcing you to reconnect every time.
Control
With an API you can control the flow of data to and from your database. You can implement rate limiting, and monitoring of all of your requests. If you need to change business logic, or even what database or resources are used via each API request, you can do this on the server, without having to redeploy a mobile app.
Resources
With an API, you reduce the need for server resources. While you may have to setup another server to handle an API, the REST API is designed to be stateless and efficient. Scaling to many users in the future is easier with an API.
I would like to create a new IdentityServer4 for a .NetCore MVC Project without ASP-Authentication, which gets the users from an existing MS SQL-database.
The user database should not have to be changed, if not necessary.
Unfortunately, previous tutorials could not help me, because a lot has been revised.
What steps are necessary to achieve this?
Hope you can help me,
best regards
The Identity server i am currently working on used to connect to a MsSQL server database that contained legacy users. The identity server itself stored its own tables in its database. I believe the way it worked was it had its on UserDbContext added to the middelwere.
So what we had was.
Identity server database - clients and stuff
Legacy user database - All user data.
Which is close to what you are talking about
services.AddDbContext<UserDbContext>(builder => builder.UseSqlServer(settingsSetup.ConnectionStrings.UserDatabaseConnection));
Everything ran though a custom UserManager.
It no longer runs this way as over the summer i integrated all of the users to Asp .net core identity and the data now resides in the same database as the identity server.
I can dig around in the solution control old branches if you need more info.
I want design consideration on which one to use either- NodeJS or Asp.Net web api in showing real time analytics data in the UI. The backend is using Oracle DB.
Whenever there is any change in the data in db, the UI should reflect immediately. Thought of using SignalR. But the UI should get notified from db directly.
I have gone through this link for nodejs and oracle:
https://jsao.io/2015/02/real-time-data-with-node-js-socket-io-and-oracle-database/#comment-261
But this requires Linux OS, which I am not sure as always i was considering to develop on windows.
I have seen this link-Database Change Notification With ODP.NET. I am not sure if this would help me.If anyone has experience with this , please can they share their experience.
http://www.oracle.com/webfolder/technetwork/tutorials/obe/db/dotnet/changenotification/ChangeNotification.htm
If anyone can guide me if i can accomplish this using Asp.net or Nodejs, it would be great.
Thanks,
WH
Sorry, if this sounds ignorant. Is it possible to SECURELY upload data from a Windows Forms app using an asp.net web service or some other method? If so, what is the general way of doing it?
I have never used web services before.
I have an IIS 6 server with .net 3.5 installed. I need to build this windows forms program, which will hold data in a local sql compact database. When the program has access to the internet, the user needs to be able to MOVE the local data to a database on the web server.
What ways can I go about doing this? Am I on the right track thinking about web services? I have also read a bit about Sync Framework, but I'm not sure if that is all that well suited for this.
Thanks for suggestions.
EDIT
I forgot to ask: Would WCF be a possible useful technology?
Yes. Just secure the web service by SSL.
WCF can be a useful technology too. You might also want to consider SQL Server merge replication.