sqlite - C# Generics on Auto-Implemented Property Classes -


I have created a property class representing the table schema of my SQLite database, each attribute in the class becomes an attribute in the database. . SQLiteTables {public class tblPerson {[PrimaryKey, AutoIncrement] public int PersonID {get; Set; } Public String PersonFirstName {Receive; Set; } Public String PersonMiddleName {get; Set; } Public String PersonListName {get; Set; }} Public class tblSchedule {[PrimaryKey, AutoIncrement] Public int ScheduleID {get; Set; } Public string scheduling {received; Set; } Start public date time list {get; Set; } Public Date Time Schedule {get; Set; }}

Now, to get some data from a table,

  public zero GetPersonList () {list & lt; TblPerson & gt; LstTemp = dbConn.Table & lt; TblPerson & gt; (). ToList & lt; TblPerson & gt; (); // some 20 lines code here}   

I would not want to type type-specific methods, well this is a tedious task. I want to make a reusable method that can retrieve data on any table using generic implementation. How can I get it?

Edit I'm working on the Windows Phone 8 platform.

This should work for you.

  Public listing & lt; T & gt; GetItems & lt; T & gt; () {Return dbConn.Table & lt; T & gt; (). ToList & lt; T & gt; (); }    

Comments

Popular posts from this blog

python - how we can use ajax() in views.py in django? -

matlab - Using loops to get multiple values into a cell -

python - Sequence Pattern recognition with Pybrain -