Skip to content

Instantly share code, notes, and snippets.

View yostane's full-sized avatar

Yassine Benabbas yostane

View GitHub Profile
Hello World Entity Framework Core!
Current database content
Persona 5 - PS4
Steins's Gate - PSVita
PS4 Games
Persona 5 - PS4
Deleting PS4 Games
Current database content
Steins's Gate - PSVita
using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
namespace efcore_tuto_1 {
class Program {
static void Main (string[] args) {
Console.WriteLine ("Hello World Entity Framework Core!");
using (var context = new VideoGamesDatabaseContext ()) {
using System.ComponentModel.DataAnnotations;
namespace efcore_tuto_1 {
public class VideoGame {
[Key]
public int Id { get; set; }
public string Title { get; set; }
public string Platform { get; set; }
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.2" />
Current database content
Persona 5 - PS4
Steins's Gate - PSVita
PS4 Games
Persona 5 - PS4
Deleting PS4 Games
Current database content
Steins's Gate - PSVita
using System;
using System.Linq;
namespace efcore_tuto_1 {
class Program {
static void Main (string[] args) {
Console.WriteLine ("Hello World Entity Framework Core!");
using (var context = new VideoGamesDatabaseContext ()) {
using Microsoft.EntityFrameworkCore;
namespace efcore_tuto_1
{
/// <summary>
/// This class handles the sqlite database
/// </summary>
public class VideoGamesDatabaseContext : DbContext
{
/// <summary>
using System.ComponentModel.DataAnnotations;
namespace efcore_tuto_1 {
public class VideoGame {
[Key]
public int Id { get; set; }
public string Title { get; set; }
public int Platform { get; set; }
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="1.1.2"/>
</ItemGroup>
func read(){
//read a value from the characteristic
let readFuture = self.dataCharacteristic?.read(timeout: 5)
readFuture?.onSuccess { (_) in
//the value is in the dataValue property
let s = String(data:(self.dataCharacteristic?.dataValue)!, encoding: .utf8)
DispatchQueue.main.async {
self.valueLabel.text = "Read value is \(s)"
print(self.valueLabel.text!)
}