SlideShare a Scribd company logo
Simple.Data
.NET database access made easier
ADO.NET
using (var connection = new SqlConnection(connectionString)) {
using (var command = connection.CreateCommand()) {
command.CommandText = "select Id, FirstName, LastName“
+ " from people where Id = @id";
command.Parameters.Add("@id", SqlDbType.Int).Value = id;
connection.Open();
using (var reader = command.ExecuteReader()) {
if (reader.Read()) {
return new Person {
Id = reader.GetInt32(0),
FirstName = reader.IsDBNull(1) ? “” : reader.GetString(1),
LastName = reader.IsDBNull(2) ? “” : reader.GetString(2),
};
} } } }
Microsoft.Data
// What you should do...
using (var database = Database.Open())
{
var sql = "select Id, FirstName, LastName"
+ " from people where Id = @0";
return database.Query(sql, id);
}
Microsoft.Data
// What PHP refugees will actually do...
using (var database = Database.Open())
{
var sql = "select Id, FirstName, LastName"
+ " from people where Id = “ + id;
return database.Query(sql);
}
Simple.Data
var database = Database.Open();
return database.People.FindById(id);
// Easier to do it right
Simple.Data…
…is Database agnostic
…is naming-style tolerant
PascalCase, SHOUTY_CASE, snake_case
…favours Convention over Configuration
…is not an O/RM
Simple CRUD
db.People.Insert(Id: 1, FirstName: “Bob”, …);
db.People.FindAllByName(“Bob”);
db.People.FindByFirstNameAndLastName(“Bob”, “X”);
db.People.UpdateById(Id: 1, FirstName: “Robert”);
db.People.DeleteById(1);
Complex queries
 db.Find(db.Users.JoinDate >= new DateTime(2010,11,13);
 db.Find(db.Posts.Comments.Approved != "Y")
 db.Find(db.Users.Age >= 18 && db.Users.Age <= 35)
 (Simple.Data uses operator overloading to turn these
expressions into its own SimpleExpression objects)
Simple O/RM
var person = db.People.FindById(1);
foreach (var telNo in person.PhoneNumbers)
{
if (telNo.DiallingCode.StartsWith(“07”))
{
SendSpamText(telNo);
}
}
Simple.Data…
…is Open Source (MIT license)
…can be downloaded from:
http://github.com/markrendle/Simple.Data/
…wants to be forked, patched and loved
Mark Rendle ~ twitter.com/markrendle ~ blog.markrendle.net

More Related Content

ODP
Mongo indexes
paradokslabs
 
PDF
Ext GWT 3.0 Data Widgets
Sencha
 
PPTX
Indexing In MongoDB
Kishor Parkhe
 
PPTX
04 data accesstechnologies
Bat Programmer
 
PDF
Saving Data
SV.CO
 
PDF
09.Local Database Files and Storage on WP
Nguyen Tuan
 
PDF
Brief introduction of Slick
Knoldus Inc.
 
Mongo indexes
paradokslabs
 
Ext GWT 3.0 Data Widgets
Sencha
 
Indexing In MongoDB
Kishor Parkhe
 
04 data accesstechnologies
Bat Programmer
 
Saving Data
SV.CO
 
09.Local Database Files and Storage on WP
Nguyen Tuan
 
Brief introduction of Slick
Knoldus Inc.
 

What's hot (18)

PPTX
GreenDao Introduction
Booch Lin
 
PDF
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
GOKUL SREE
 
PDF
Green dao
彥彬 洪
 
PPTX
Is2215 lecture8 relational_databases
dannygriff1
 
PDF
Creating, Updating and Deleting Document in MongoDB
Wildan Maulana
 
PPTX
SQLite with UWP
Cheah Eng Soon
 
PDF
The Ring programming language version 1.5.1 book - Part 27 of 180
Mahmoud Samir Fayed
 
PPTX
Slick: Bringing Scala’s Powerful Features to Your Database Access
Rebecca Grenier
 
PDF
Green dao
Droidcon Berlin
 
PDF
The Ring programming language version 1.7 book - Part 32 of 196
Mahmoud Samir Fayed
 
PDF
MongoDB
Hemant Kumar Tiwary
 
PPTX
Sequelize
Tarek Raihan
 
PPTX
NoSQL Endgame Percona Live Online 2020
Thodoris Bais
 
PDF
greenDAO
Mu Chun Wang
 
ODP
2011 Mongo FR - Indexing in MongoDB
antoinegirbal
 
PDF
The Ring programming language version 1.5.2 book - Part 28 of 181
Mahmoud Samir Fayed
 
PPTX
Indexing & Query Optimization
MongoDB
 
PPTX
Getting Started with MongoDB
Ahasanul Kalam Akib
 
GreenDao Introduction
Booch Lin
 
DOT NET LAB PROGRAM PERIYAR UNIVERSITY
GOKUL SREE
 
Green dao
彥彬 洪
 
Is2215 lecture8 relational_databases
dannygriff1
 
Creating, Updating and Deleting Document in MongoDB
Wildan Maulana
 
SQLite with UWP
Cheah Eng Soon
 
The Ring programming language version 1.5.1 book - Part 27 of 180
Mahmoud Samir Fayed
 
Slick: Bringing Scala’s Powerful Features to Your Database Access
Rebecca Grenier
 
Green dao
Droidcon Berlin
 
The Ring programming language version 1.7 book - Part 32 of 196
Mahmoud Samir Fayed
 
Sequelize
Tarek Raihan
 
NoSQL Endgame Percona Live Online 2020
Thodoris Bais
 
greenDAO
Mu Chun Wang
 
2011 Mongo FR - Indexing in MongoDB
antoinegirbal
 
The Ring programming language version 1.5.2 book - Part 28 of 181
Mahmoud Samir Fayed
 
Indexing & Query Optimization
MongoDB
 
Getting Started with MongoDB
Ahasanul Kalam Akib
 
Ad

Viewers also liked (8)

PDF
Oranmor whisky list
Peter Dundas
 
PPT
1 phuong phap ban hang va cham soc khach hang
duongdinhson
 
PPTX
Gm대우 최종
HyunChul Choi
 
ODP
Eivissa
diana
 
PPTX
Functional Alchemy
Mark Rendle
 
PDF
Entregable modulo 2
Rogelio Pincheira
 
KEY
Mbr 000 Live
MBROL
 
PPT
Bgv spreuken
Annemiekelos
 
Oranmor whisky list
Peter Dundas
 
1 phuong phap ban hang va cham soc khach hang
duongdinhson
 
Gm대우 최종
HyunChul Choi
 
Eivissa
diana
 
Functional Alchemy
Mark Rendle
 
Entregable modulo 2
Rogelio Pincheira
 
Mbr 000 Live
MBROL
 
Bgv spreuken
Annemiekelos
 
Ad

Similar to Simple.Data intro slides (20)

PPT
Ado.net
Iblesoft
 
PPTX
37c
Sireesh K
 
PPT
Marmagna desai
jmsthakur
 
PPT
Lecture 6. ADO.NET Overview.
Alexey Furmanov
 
PPSX
ADO.NET
Farzad Wadia
 
PDF
Ado.Net Architecture
Umar Farooq
 
PDF
Introduction to Simple.Data
Tim Bourguignon
 
PPT
the .NET Framework. It provides the claf
TesfahunMaru1
 
PPTX
5.C#
Raghu nath
 
PPTX
ADO.NET by ASP.NET Development Company in india
iFour Institute - Sustainable Learning
 
PPTX
Asp .Net Database Connectivity Presentation.pptx
sridharu1981
 
PPT
For Beginers - ADO.Net
Snehal Harawande
 
PPTX
Csharp_dotnet_ADO_Net_database_query.pptx
facebookrecovery1
 
PDF
5c8605.ado.net
harkesh singh
 
PPTX
Ado .net
Manish Singh
 
PPTX
Net database
Benny Skogberg
 
PPT
ASP.NET Session 11 12
Sisir Ghosh
 
PPTX
Unit4.pptx Data Access File System Data
Priyanka Jadhav
 
PPTX
LECTURE 14 Data Access.pptx
AOmaAli
 
PPTX
Introduction to ms access database
Obuasi Senior High Technical School
 
Ado.net
Iblesoft
 
Marmagna desai
jmsthakur
 
Lecture 6. ADO.NET Overview.
Alexey Furmanov
 
ADO.NET
Farzad Wadia
 
Ado.Net Architecture
Umar Farooq
 
Introduction to Simple.Data
Tim Bourguignon
 
the .NET Framework. It provides the claf
TesfahunMaru1
 
ADO.NET by ASP.NET Development Company in india
iFour Institute - Sustainable Learning
 
Asp .Net Database Connectivity Presentation.pptx
sridharu1981
 
For Beginers - ADO.Net
Snehal Harawande
 
Csharp_dotnet_ADO_Net_database_query.pptx
facebookrecovery1
 
5c8605.ado.net
harkesh singh
 
Ado .net
Manish Singh
 
Net database
Benny Skogberg
 
ASP.NET Session 11 12
Sisir Ghosh
 
Unit4.pptx Data Access File System Data
Priyanka Jadhav
 
LECTURE 14 Data Access.pptx
AOmaAli
 
Introduction to ms access database
Obuasi Senior High Technical School
 

Recently uploaded (20)

PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PDF
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
PDF
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
PDF
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
How ETL Control Logic Keeps Your Pipelines Safe and Reliable.pdf
Stryv Solutions Pvt. Ltd.
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
AI-Cloud-Business-Management-Platforms-The-Key-to-Efficiency-Growth.pdf
Artjoker Software Development Company
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
GDG Cloud Munich - Intro - Luiz Carneiro - #BuildWithAI - July - Abdel.pdf
Luiz Carneiro
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
Trying to figure out MCP by actually building an app from scratch with open s...
Julien SIMON
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 

Simple.Data intro slides

  • 2. ADO.NET using (var connection = new SqlConnection(connectionString)) { using (var command = connection.CreateCommand()) { command.CommandText = "select Id, FirstName, LastName“ + " from people where Id = @id"; command.Parameters.Add("@id", SqlDbType.Int).Value = id; connection.Open(); using (var reader = command.ExecuteReader()) { if (reader.Read()) { return new Person { Id = reader.GetInt32(0), FirstName = reader.IsDBNull(1) ? “” : reader.GetString(1), LastName = reader.IsDBNull(2) ? “” : reader.GetString(2), }; } } } }
  • 3. Microsoft.Data // What you should do... using (var database = Database.Open()) { var sql = "select Id, FirstName, LastName" + " from people where Id = @0"; return database.Query(sql, id); }
  • 4. Microsoft.Data // What PHP refugees will actually do... using (var database = Database.Open()) { var sql = "select Id, FirstName, LastName" + " from people where Id = “ + id; return database.Query(sql); }
  • 5. Simple.Data var database = Database.Open(); return database.People.FindById(id); // Easier to do it right
  • 6. Simple.Data… …is Database agnostic …is naming-style tolerant PascalCase, SHOUTY_CASE, snake_case …favours Convention over Configuration …is not an O/RM
  • 7. Simple CRUD db.People.Insert(Id: 1, FirstName: “Bob”, …); db.People.FindAllByName(“Bob”); db.People.FindByFirstNameAndLastName(“Bob”, “X”); db.People.UpdateById(Id: 1, FirstName: “Robert”); db.People.DeleteById(1);
  • 8. Complex queries  db.Find(db.Users.JoinDate >= new DateTime(2010,11,13);  db.Find(db.Posts.Comments.Approved != "Y")  db.Find(db.Users.Age >= 18 && db.Users.Age <= 35)  (Simple.Data uses operator overloading to turn these expressions into its own SimpleExpression objects)
  • 9. Simple O/RM var person = db.People.FindById(1); foreach (var telNo in person.PhoneNumbers) { if (telNo.DiallingCode.StartsWith(“07”)) { SendSpamText(telNo); } }
  • 10. Simple.Data… …is Open Source (MIT license) …can be downloaded from: http://github.com/markrendle/Simple.Data/ …wants to be forked, patched and loved Mark Rendle ~ twitter.com/markrendle ~ blog.markrendle.net