/// <summary> /// Exports the specified sheet to passed gateway and removes old data from passed gateway /// <example> /// <code> /// var target = new DbGateway(DbAccessor.Create("SampleDb")); /// var source = (ExcelAccessor)DbAccessor.Create("SampleExcelFile"); /// /// source.ExportWithClean<Contact>(target, "Contacts"); /// </code> /// </example> /// </summary> /// <typeparam name="T"></typeparam> /// <param name="sheetName">Name of the sheet.</param> /// <param name="targetGateway">The target gateway.</param> public void ExportWithClean <T>(DbGateway targetGateway, string sheetName) where T : class, new() { T[] list = LoadList <T>(sheetName); targetGateway.Delete(typeof(T)); targetGateway.Import(list); }
/// <summary> /// Exports the specified sheet to passed gateway. /// <example> /// <code> /// var target = new DbGateway(DbAccessor.Create("SampleDb")); /// var source = (ExcelAccessor)DbAccessor.Create("SampleExcelFile"); /// /// source.Export<Contact>("Contacts", target); /// </code> /// </example> /// </summary> /// <typeparam name="T"></typeparam> /// <param name="targetGateway">The target gateway.</param> /// <param name="sheetName">Name of the sheet.</param> public void Export <T>(DbGateway targetGateway, string sheetName) where T : class, new() { T[] list = LoadList <T>(sheetName); targetGateway.Import(list); }