public static void SimpleDbRecordWithOptionsAndMultipleColumnsAndFilter() { IEnumerable <IDictionary <string, object> > table; using (var connection = new SqlConnection("Data Source=localhost;Initial Catalog=DatingApp;Integrated Security=True")) { connection.Open(); const string data = @" SELECT * from test "; table = connection.Query(data) as IEnumerable <IDictionary <string, object> >; } var enumerable = table as IDictionary <string, object>[] ?? (table ?? throw new InvalidOperationException()).ToArray(); var s = DbTable.Add(enumerable, new Options { DateFormat = "dd-MM-yy", DecimalFormat = "#,##0.########" }).FilterColumns(new[] { "AssetClass" }, FilterAction.Exclude).ToString(); Console.WriteLine(s); s = DbTable.Add(enumerable, new Options { DateFormat = "dd-MM-yy", DecimalFormat = "#,##0.########" }).FilterColumns(new[] { "AssetClass" }, FilterAction.Exclude).ToSpecFlowString(); Console.WriteLine(s); }
public static void SimpleDbRecord() { IEnumerable <IDictionary <string, object> > table; using (var connection = new SqlConnection("Data Source=localhost;Initial Catalog=DatingApp;Integrated Security=True")) { connection.Open(); const string data = @" SELECT [Id] ,[SenderId] ,[SenderUsername] ,[RecipientId] ,[RecipientUsername] ,[Content] ,[DateRead] ,[MessageSent] ,[SenderDeleted] ,[RecipientDeleted] FROM [DatingApp].[dbo].[Messages] "; table = connection.Query(data) as IEnumerable <IDictionary <string, object> >; } var enumerable = table as IDictionary <string, object>[] ?? (table ?? throw new InvalidOperationException()).ToArray(); var s = DbTable.Add(enumerable).ToString(); Console.WriteLine(s); s = DbTable.Add(enumerable).ToSpecFlowString(); Console.WriteLine(s); }
public new async Task <int> CreateAsync(User user) { DbTable.Add(user); var result = await SaveChangesAsync(); _usersCache.Invalidate((await ReadAllAsync()).ToList()); return(result); }