// Get the count of elements in the Roles table using DbQueryScalar static void GetRolesCount() { Activity dbSelectCount = new DbQueryScalar<int>() { ConfigName = "DbActivitiesSample", Sql = "SELECT COUNT(*) FROM Roles" }; IDictionary<string, object> results = WorkflowInvoker.Invoke(dbSelectCount); Console.WriteLine("Result: {0}", results["Result"].ToString()); }
// Retrieves the current date using a DbQueryScalar static void GetCurrentDate() { Activity dbSelectCount = new DbQueryScalar<DateTime>() { ProviderName = providerInvariantName, ConnectionString = connectionString, Sql = "SELECT GetDate()" }; IDictionary<string, object> results = WorkflowInvoker.Invoke(dbSelectCount); Console.WriteLine("Result: {0}", results["Result"].ToString()); }