KEMBAR78
Getting started with .net on openSUSE (asp.net with c#) | PDF
Getting Started with .NET on
OpenSuse
(ASP.NET with C#)
Alin Nur Alifah / Alin
alinnural@gmail.com
Alin Nur Alifah
Alin
alinnural.com
@alinnural
GNU Linux Bogor Activist
WEB Developer @IPB
Ilkomerz @IPB
Thank you
Thank you
For join my class
Lets sharing...
.NET ???
.NET ???
.NET is a layer of software that makes it easier for you to write
programs
.NET Core
Vs
.NET Framework
.NET Core
Vs
.NET Framework
.NET Core is a general purpose, modular, cross-platform and open
source implementation of the .NET Platform.
.NET with C# Languange
C# Languange
The C# language is disarmingly simple, which makes it good for beginners, but
C# also includes all the support for the structured, component-based,
object-oriented programming that one expects of a modern language built on
the shoulders of C++ and Java.
Lets Code...
Install dotnet
# sudo zypper install libunwind libicu
# curl -sSL -o dotnet.tar.gz
https://go.microsoft.com/fwlink/?LinkID=827532
# sudo mkdir -p /opt/dotnet && sudo tar zxf
dotnet.tar.gz -C /opt/dotnet
# sudo ln -s /opt/dotnet/dotnet /usr/local/bin
Let's initialize a sample Hello World
application!
# mkdir hwapp
# cd hwapp
# dotnet new
# dotnet restore
# dotnet run
Let's initialize a sample Hello World
application!
Simple
ASP.NET Core
Application
Node.js and npm
is required !
Install node.js and npm
# wget -qO-
https://raw.githubusercontent.com/creation
ix/nvm/v0.31.7/install.sh | bash
# source ~/.bashrc
# nvm install v.x.xx.x
Scaffolding usings Yeoman
Install the necessary yeoman generators and bower using npm.
# npm install -g yo generator-aspnet bower
Run the ASP.NET Core generator
# yo aspnet
# dotnet restore
# dotnet run
Scaffolding usings Yeoman
Scaffolding usings Yeoman
Sub Generators
https://github.com/omnisharp/generator-as
pnet#sub-generators
eg : add a new class
# yo aspnet:mvccontroller BlogController
Connect Database
New SQLite Database
"dependencies": {
"Microsoft.EntityFrameworkCore.Sqlite": "1.0.0",
"Microsoft.EntityFrameworkCore.Design": {
"version": "1.0.0-preview2-final",
"type": "build"
}
"tools": {
"Microsoft.EntityFrameworkCore.Tools":
"1.0.0-preview2-final"
}
Connect Database
Verify that Entity Framework is installed by running
# dotnet ef - -help
Run dotnet restore again to install the new packages.
# dotnet restore
Create Model
Generate Database
This will find our context and models, and generate a migration
# dotnet ef migrations add MyFirstMigration
create the database file and creates the tables
# dotnet ef database update
Use Model on Controller
[HttpGet]
[AllowAnonymous]
public IActionResult Index(string nama = null)
{
var db = new BloggingContext();
db.Blogs.Add(new Blog { Url = nama });
db.SaveChanges();
ViewData["daftarBlog"] = db.Blogs;
return View();
}
Thank you
Referensi
https://docs.asp.net/en/latest/tutorials/your-first-mac-aspnet.html
https://docs.asp.net/en/latest/client-side/yeoman.html
https://github.com/omnisharp/generator-aspnet#sub-generators

Getting started with .net on openSUSE (asp.net with c#)