Understanding c# class markup like SQLite -




using sqlite library, can create class like

namespace myapp {     [table("mydatatable")]     public class mydata     {         [primarykey, autoincrement, column("_id")]         public int id { get; set; }          [unique, notnull]         public guid guid { get; set; }          [maxlength(256), notnull]         public string name { get; set; }          [notnull]         public datetime created { get; set; }          public int mynumber { get; set; }     } } 

then can create database class like

namespace myapp {     public class sqlitedatabase     {         protected sqliteconnection conn;          public sqlitedatabase()         {         }          public void attach(string dbname)         {             conn = new sqliteconnection(dbname);         }          public void createtable<t>()         {             conn.createtable<t>();         }          public int insert(object t)         {             return conn.insert(t);         }     } } 

this wonderful , makes using sqlite easy. how write own code different? example, rather write data sqlite database, let's wanted convert myapp instance , send on nework.

namespace myapp {     public class mydatabasehandler     {         public void createtable<t>()         {             // how table name "mydatatable"?             // how column names , types?             // once information, can send post server , create table on backend         }          public int insert(object t)         {             // how table name "mydatatable"?             // how column names , values of each data member?             // once information, can send post server , insert record.         }     } } 

https://msdn.microsoft.com/en-us/library/ms973893.aspx?f=255&mspperror=-2147217396

look serialization in .net

you can convert classes down xml files , pass xml file across network , load them @ new location class.

additionally using tcp regardless you're going have convert data type of serialized class.





wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -

python - Read npy file directly from S3 StreamingBody -