1.First of all create three different environment with i.Debug .To work with local environment ii.Staging Details…
Category: asp.net core
This a about Microsoft .net core technology
Asynchronous Programming in asp.net core with an example
#ConectionString from startup public static string ConnectionString { get; private set; } ConnectionString = Configuration.GetValue(“Data:DefaultConnection:ConnectionString”); Details…
Use Stored Procedure in Ef Core
–Stored Procedure create proc SpUserInfo as BEGIN select 1 Id,’akash’ Name; END and EF core Details…
Global Exception Handler in asp.net core
In the ASP 5 aka core all configuration from former MVC 5 global.asax goes into Details…
File Upload asp.net core
Create a project in VS2015. 01.File->New->Project->asp.netcore web application 02.Now we have to Store all the Details…
Dapper Query With CRUD in Asp.net Core 1.0
First install Visual studio 2015. Create a New .NET core project In Option->Nuget Package manager Details…
Connect to MySql EF core
CREATE A table CREATE TABLE IF NOT EXISTS employees ( Id int(11) NOT NULL, first_name Details…
Connect to MySql by Ado.net in Ef Core
create a database test in mysql #Schema
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
CREATE TABLE IF NOT EXISTS `employees` ( `Id` int(11) NOT NULL, `first_name` text NOT NULL, `last_name` text NOT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumping data for table `employees` -- INSERT INTO `employees` (`Id`, `first_name`, `last_name`) VALUES (1, 'aaaa', 'cccc'), (2, 'ssss', 'cccc'); |
#project.json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
{ "version": "1.0.0-*", "buildOptions": { "debugType": "portable", "emitEntryPoint": true }, "dependencies": {}, "frameworks": { "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": { "type": "platform", "version": "1.0.0" }, "MySql.Data.Core": "7.0.4-IR-191" }, "imports": "dnxcore50" } } } |
#.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
using System; using MySql.Data.MySqlClient; namespace ConsoleApplication { public class Program { public static void Main(string[] args) { Console.WriteLine("Hello World!"); MySqlConnection connection = new MySqlConnection { ConnectionString = "server=localhost;user id=root;password=;port=3306;database=test;SslMode=None" }; connection.Open(); MySqlCommand command = new MySqlCommand("SELECT * FROM employees;", connection); using (MySqlDataReader reader = command.ExecuteReader()) { System.Console.WriteLine("Category Id\t\tName\t\tLast Update"); while (reader.Read()) { string row = $"{reader["Id"]}\t\t{reader["first_name"]}\t\t{reader["last_name"]}"; System.Console.WriteLine(row); } } connection.Close(); System.Console.ReadKey(); } } } |
Entity Framework 7 with .net core 1
Today i am in mode to write ef 7 with code first with .NET core Details…