Preface:
Since accessing ASP. NET, database operations have become a common part of all website projects,
I have gone through many ways and made many detours.Code(Especially like subsonic), you should release your own,
For your reference.
Introduction:
Tianvdata is one of the main components of our company's upcoming tianvcms.
It is a small, simple, and fast database component. By using the native dbproviderfactory, it makes cross-database quite convenient.
Usage:
The download package contains the specific content of the usage method. Here we will simply paste some code:
View code
Private VoidTestormwithoutdb (){VaRP1 =NewNews_info () {Title ="First Title"}; P1.insert ();IntLastid =P1.id;VaRP2 =News_info.select (lastid); p2.title="Second Title"; P2.update (); p2.delete ();}
View code
Private Void Test10000text (){ Using (DB = New DB ( " Tianv " )){ VaR P1 = dB. executenonquery ( " Insert into news_info (title) values ('first title ') " ); Int Lastid = dB. executescalar < Int > ( " Select max (ID) from news_info " ); VaR P2 = dB. executenonquery ( " Update news_info set Title = 'second title' where id = " + Lastid ); VaR P3 = dB. executescalar ( " Select title from news_info where id = " + Lastid ); Using ( VaR Reader = dB. executereader ( " Select * From news_info where ID> = 1 limit 10 offset 0 " )){} VaR P4 = dB. executetable ( " Select * From news_info where ID> = 1 limit 10 offset 0 " ); VaR P5 = dB. executescalar < String > ( " Select title from news_info where id = " + Lastid ); VaR P6 = dB. executesingle <news_info> ( " Select * From news_info where id = " + Lastid ); VaR P7 = dB. executelist <news_info> ( " Select * From news_info where ID> = 1 limit 10 offset 0 " ); VaR P8 = dB. executenonquery ( " Delete from news_info where id = " + Lastid );}}
View code
Private Void Test10000texthelperwithoutdb (){ VaR Lastid = SQL <news_info>. Insert (). Set (T => T. title, " First Title " ). Executescalar < Int > (); VaR P2 = SQL <news_info> . Update (). Set (T => T. title, " Second Title " ). Where (T => T. ID," = " , Lastid). executenonquery (); VaR P3 = SQL <news_info> . Select (). Columns (T => T. Title). Where (T => T. ID, " = " , Lastid). executescalar (); VaR P4 = SQL <news_info>. Select (). Where (T => T. ID, " > = " , 1 ). Limit ( 10 ). Skip ( 0 ). Executetable (); VaR P5 = SQL <news_info> . Select (). Columns (T => T. Title). Where (T => T. ID," = " , Lastid). executescalar < String > (); VaR P6 = SQL <news_info> . Select (). Where (T => T. ID, " = " , Lastid). Limit ( 10 ). Skip ( 0 ). Executesingle (); VaR P7 = SQL <news_info> . Select (). Where (T => T. ID, " > = " , 1 ). Limit ( 10 ). Skip ( 0 ). Executelist (); VaR P8 = SQL <news_info>. Delete (). Where (T => T. ID, " = " , Lastid). executenonquery ();}
Open Source:
Tianvdata adopts the gplv2 open source protocol.
Download:
Open Source: https://tianvdata.codeplex.com/
: Http://tianvdata.codeplex.com/releases/
Simple document: http://tianvdata.codeplex.com/documentation