public E GetSingle(object where, Needletail.DataAccess.Engines.FilterType filterType = Needletail.DataAccess.Engines.FilterType.AND) { var result1 = _SqlCEContext.GetSingle(where, filterType); if (result1 == null) { //search in the MSSQL result1 = _MSSQLContext.GetSingle(where, filterType); //add it to the sqlCE if (result1 != null) { _SqlCEContext.Insert(result1); } } return(result1); }
public void insert(object o,string tipo) { if(tipo.Equals("usuario")) { var needleTailContext = new DBTableDataSourceBase<Usuario, int>("connectionString", "usuario"); needleTailContext.Insert((Usuario)o); } if (tipo.Equals("tarea")) { } }
/* First version of Needletail tools. Don't forget to check the documentation: [url:https://needletailtools.codeplex.com/documentation] *This is release is beta, but a few live sites are using this on their production environments * */ static void Main(string[] args) { //Force Migration on on application startup Migrator.Migrate("localConnectionString"); Console.WriteLine("Done Migrating"); Console.ReadKey(); var context = new DBTableDataSourceBase<Task ,Guid>("localConnectionString", "Tasks"); //Insert a new task context.Insert(new Task { TaskId = Guid.NewGuid(), CreatedOn = DateTime.Now, DueOn = DateTime.Now.AddDays(10), Name= "Sample Task", Description="This is a sample task"}); }
private bool MoveDataBetweenServers(DBTableDataSourceBase <E, K> source, DBTableDataSourceBase <E, K> target, object where, Needletail.DataAccess.Engines.FilterType filterType) { //get the data to move var toMove = source.GetMany(where, filterType, null, null); foreach (var e in toMove) { //insert the data target.Insert(e); } //delete the data return(source.Delete(where, filterType)); }
/* * First version of Needletail tools. * * Don't forget to check the documentation: * [url:https://needletailtools.codeplex.com/documentation] * * This is release is beta, but a few live sites are using this on their production environments * * */ static void Main(string[] args) { //Force Migration on on application startup Migrator.Migrate("localConnectionString"); Console.WriteLine("Done Migrating"); Console.ReadKey(); var context = new DBTableDataSourceBase <Task, Guid>("localConnectionString", "Tasks"); //Insert a new task context.Insert(new Task { TaskId = Guid.NewGuid(), CreatedOn = DateTime.Now, DueOn = DateTime.Now.AddDays(10), Name = "Sample Task", Description = "This is a sample task" }); }