vendredi 31 juillet 2015

How do I get a Sqlite Table attribute from a Class?

I would like to get a Sqlite Table attribute from my class.

I have a method to check if a table exists from here:

var info = database.Connection.GetTableInfo(typeof(Customer).Name);
if (info.Any())
{
    //do stuff with table
}

where Customer is:

[Table("Customer")]
public class Customer
{
  //class stuff
}

Now my method will work fine as it is but I would like to link it to the Table attribute rather than the class name incase I change the table name in future.

How do I go about getting my Table attribute from my class?

Ps. I am using a PCL (Portable Class Library)

Aucun commentaire:

Enregistrer un commentaire