2013-08-01 10 views
6

Se utilizzo SQL Server CE per Windows Phone, è possibile selezionare le proprietà di una mappa di classe nelle tabelle del database. Questo mi permette di avere proprietà astratte su una classe.Windows Phone: come escludere colonne/proprietà in SQLite-net?

per esempio

[Table] 
public class MyClass 
{ 
    // this property is written to the database 
    private int _ItemId; 

    [Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)] 
    public int ItemId 
    { 
     get 
     { 
      return _ItemId; 
     } 
     set 
     { 
      _ItemId = value; 
     } 
    } 

    // abstract class. obviously this just an example. the real code checks for 11. =) 
    // under SQLite, it looks like this will get stored in the db? 
    public bool IsItemIdSeven 
    { 
     get{ return _ItemId == 7; } 
    } 
} 

E 'possibile escludere oggetti di una definizione di classe in SQLite-net? Non riesco a utilizzare le estensioni in quanto alcune di queste proprietà sono utilizzate da Bindings UI.

+0

SQLite non include ORM di per sé. Cosa stai usando per ORM? –

+0

Se si utilizza [SQLite-net] (https://github.com/praeclarum/sqlite-net) è possibile utilizzare l'attributo '[Ignora]'. –

+0

Come dire @AlaaMasoud nella libreria [sqlite-net] (https://github.com/praeclarum/sqlite-net) in questo caso è necessario utilizzare 'SQLite.IgnoreAttribute' ' [SQLite.Ignore] public bool IsItemIdSeven {get; impostato; } ' – jimpanzer

risposta

13

Se si utilizza SQLite-net è possibile utilizzare l'attributo [Ignore]

+0

Alaa Ho avuto problemi con Ignora in Windows Phone, sai di qualsiasi lavoro in giro? – Juan