using System; using System.Collections.Generic; using System.Linq.Expressions; namespace MatterHackers.MatterControl.DataStorage { [AttributeUsage(AttributeTargets.Property)] public class PrimaryKeyAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property)] public class AutoIncrementAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property)] public class IndexedAttribute : Attribute { public string Name { get; set; } public int Order { get; set; } public virtual bool Unique { get; set; } public IndexedAttribute() { } public IndexedAttribute(string name, int order) { Name = name; Order = order; } } public interface ISQLite { int Insert(object obj); int CreateTable(Type ty); int DropTable(Type ty); int Update(object obj); int Delete(object obj); ITableQuery Table() where T : new(); List Query(string query, params object[] args) where T : new(); //SQLiteCommand CreateCommand(string cmdText, params object[] ps); T ExecuteScalar(string query, params object[] args); int InsertAll(System.Collections.IEnumerable objects); void RunInTransaction(Action action); void Close(); } public interface ITableQuery { ITableQuery Where(Expression> predExpr); ITableQuery Clone(); int Count(); ITableQuery Deferred(); T ElementAt(int index); T First(); T FirstOrDefault(); System.Collections.Generic.IEnumerator GetEnumerator(); ITableQuery Join(ITableQuery inner, System.Linq.Expressions.Expression> outerKeySelector, System.Linq.Expressions.Expression> innerKeySelector, System.Linq.Expressions.Expression> resultSelector); ITableQuery OrderBy(System.Linq.Expressions.Expression> orderExpr); ITableQuery OrderByDescending(System.Linq.Expressions.Expression> orderExpr); ITableQuery Select(System.Linq.Expressions.Expression> selector); ITableQuery Skip(int n); ITableQuery Take(int n); } }