Read CSV File in Aspnet Core

var file = Path.Combine(_hostingEnv.WebRootPath, "data", "sample.csv");
using (var streamReader = System.IO.File.OpenText(file))
{
    var dbContext = new SampleDbContext();
    while (!streamReader.EndOfStream)
    {
        var line = streamReader.ReadLine();
        var data = line.Split(new[] { ',' });
        var person = new Person() { Name = data[0], Email = data[1], Phone = data[2] };
        dbContext.Persons.Add(person);
    }

    dbContext.SaveChanges();
}

.net Core – Mysql

MySql Connector NET for .NET Core 1.0

https://docs.efproject.net/en/latest/intro.html

Create Repository Centos

Creating a Yum Repository Server for Red Hat and CentOS

 

Valid link :┬ársync -avrt rsync://mirror.clarkson.edu/centos/ /var/www/html/CentOS/centos/ –exclude ‘2/’ –exclude ‘2.*/’ –exclude ‘3/’ –exclude ‘3.*/’ –exclude ‘4/’ –exclude ‘4.*/’ –exclude ‘5/’ –exclude ‘5.*/’ –exclude ‘6.5/isos/’ –exclude ‘6.5/os/i386/’

MySql Entity Framework in visual studio express

For the Entity Framework 6 support we need to have this requirements

  • MySQL Connector/Net 6.8.x
  • MySQL Server 5.1 or above
  • Entity Framework 6 assemblies
  • .NET Framework 4.0 or above

I will use the concept of DataBase First but without using the Visual Studio wizard to create the Edmx file, so instead of that, I will do it manually. I will create a Console Application, so first install the Entity Framework via Nuget Package

 

http://lvasquez.github.io/2014/11/18/EntityFramework-MySql/
http://www.aspsnippets.com/Articles/Using-MySQL-database-in-ASPNet-Tutorial-with-example.aspx