.Net C# Mvc Db connection (Db from other people) - database

I am new to .Net and especially new Mvc.
I have a database from a senior in his own project that I must connect using the connection string, which I can connect successfully in web config of traditional web forms.
But now I want to connect that database in Mvc. I dont have local db in my pc but can access it through the id and password in the previous project as mentioned.
So is there any ways to connect and use it in Mvc? I would like to know exactly the source code that i need to put in which part. I am totally new and still blur after reading so many tutorials.
Thanks.

What have you tried? In MVC also there is a connection string. If you want to generate classes from DataBase then you can use EntityFramework. I think only with the tool EntityFramework it can create for you the connectionSttring. Generate Model. I hope it will help you.

Related

How to Host my ASP .NET MVC Application with database?

I really need help or any kind of explanation about my problem.
I have a project built in Microsoft Visual Studio 2019. Its a ASP.NET MVC Application, and I have another project which enables me to create a database in my ("localDb")/ProjectsV13.
My approach was "Database-First", and created Model.espx automatically, and everything works fine (Used Entity Framework).
But now when I'm done making it, I need to PUBLISH It or HOST it. I don't understand the difference between that 2 terms.
I've been searching for solution for a quite a while, and still no solution.
I need to post in on CPanel.
How can someone use my app online?
How can someone see the same data as me?. Because I use localDb.
For example, I have login page for admin (just want someone to login with username:"Admin" and pw: "admin") and use my app.
I published it using FileSystem and managed to start my app with localhost. But that's not what I need
Thank you in advance!

Connecting remote database in Xamarin Forms for IOS application

I have a project has two parts.
1- Windows form or WPF application that basically connects to database and write/read/update some basic text data (this part is already done).
2- On the other hand, I am currently developing an IOS app that can connect to remote database and read/write/update data.
What is the best way to connect the same SQLite or SQL database from both Windows forms app and IOS app.
Thanks in advance
The best way is creating an API/WebService which will be the interface between the database and your clients: WPF, iOS App and any other client you might want to add in the future.
Using a WebService is more secure, I guess you wouldn't want your database username and password being everywhere.
Using a WebService allows you abstract the data layer. Not using an API and using the connection to the database directly from your Apps will tightly couple your apps with the structure of your tables and any single change that happens in the database will force you to do the changes in the apps.
With WebService you decide what information will be available to the ones consuming it.
There are many others Plus on using WebServices but hope this are enough to clear your doubt.

How to get the data from mysql database without using webservices like WCFin silverlight application

Is there any other ways so i can get the data from mysql database to show in a datagridview in a Silverlight application without using Webservice like WCF webservice .?
Silverlight is a client side web technology and as such cannot access a database directly. Web services are normally the best way to access the data you want but I guess you could get creative using an elevated trust application and reading from the file system in some kind of hacky way but that's not going to be a good idea!

WPF Client on Windows + WebService on a Linux server

Currently I am developing a WPF application which will handle alot on the client (non business logic that is).
Some data (the business logic) will be coming from a SQL database. To expose this data to the client I was thinking to create a WebService. Normally I would use a WCF Service (or Web Api) to fix this. But in this scenario, there is only a linux server available using a MySQL database, on this server I am unable to host a WCF Service.
I was wondering how I could implement the following:
Users opening the WPF client need to authenticate to the MySQL database.
Users logged in should retrieve some of their personal data coming from the MySQL database.
Which kind of Webservice or technology is the best to go for?
Thanks
You can build a web service in any language, so it comes down to which ones you're comfortable with, or which offer the best tools. If you or your team are already heavily invested in the Microsoft stack, you could try something like Monodevelop: http://monodevelop.com/

How default ASP.NET MVC 3 project account controller work

I am new in MVC3. When i create a new default ASP.NET MVC 3 project template.
There is a AccountModels.cs and AccountController.cs C# class that handle data from a ASPNETDB.MDF DB file, there is a connection string (XML) in Web.config file, but i can't understand how it handle those data where is the Query or LINQ, How AccountModels.cs or AccountController.cs file know those DB tables Can anyone make me understand step by step? please someone help me please.
Sorry for my bad English.
It is using Microsoft Membership Provider.
From the doc:
ASP.NET membership gives you a built-in way to validate and store user
credentials. ASP.NET membership therefore helps you manage user
authentication in your Web sites. You can use ASP.NET membership with
ASP.NET forms authentication by using with the ASP.NET login controls
to create a complete system for authenticating users.
Basically it has quick straight forward configuration and creates a couple of tables in your database to keep user data.
It is flexible, but the interfaces are not very well segregated and if you need to extend it or plug your custom logic you may end up defining a tons of method throwing "Not Implemented" exception

Resources