public static IInsertDataSyntax SetRouting(this IInsertDataSyntax root) { return(root .Row(new { Key = "cohort.routing.signup", Value = "signup" }) .Row(new { Key = "cohort.routing.signin", Value = "signin" }) .Row(new { Key = "cohort.routing.404", Value = "404" }) .Row(new { Key = "cohort.routing.500", Value = "500" })); }
/// <summary> /// Inserts data using Sql Server's IDENTITY INSERT feature. /// </summary> /// <param name="expression"></param> /// <returns></returns> public static IInsertDataSyntax WithIdentityInsert(this IInsertDataSyntax expression) { var castExpression = expression as ISupportAdditionalFeatures ?? throw new InvalidOperationException(UnsupportedMethodMessage(nameof(WithIdentityInsert), nameof(ISupportAdditionalFeatures))); castExpression.AdditionalFeatures[IdentityInsert] = true; return(expression); }
/// <summary> /// Inserts data using Sql Server's IDENTITY INSERT feature. /// </summary> /// <param name="expression"></param> /// <returns></returns> public static IInsertDataSyntax WithIdentityInsert(this IInsertDataSyntax expression) { ISupportAdditionalFeatures castExpression = expression as ISupportAdditionalFeatures; if (castExpression == null) { throw new InvalidOperationException("WithIdentityInsert must be called on an object that implements ISupportAdditionalFeatures."); } castExpression.AddAdditionalFeature(IdentityInsert, true); return expression; }
public static IInsertDataSyntax SetAuthVariables(this IInsertDataSyntax root) { return(root .Row(new { Key = "cohort.auth.admin_role", Value = "admin" }) .Row(new { Key = "cohort.auth.superuser_role", Value = "super" }) .Row(new { Key = "cohort.auth.superuser_email", Value = "*****@*****.**" }) .Row(new { Key = "cohort.auth.superuser_password", Value = "rosebud" }) .Row(new { Key = "cohort.auth.superuser_api_token", Value = Guid.NewGuid().ToString() }) .Row(new { Key = "cohort.auth.username", Value = "false" })); }
public static IInsertDataSyntax SetBilling(this IInsertDataSyntax root) { return(root .Row(new { Key = "cohort.stripe.enabled", Value = "true" }) .Row(new { Key = "cohort.stripe.test_mode", Value = "true" }) .Row(new { Key = "cohort.stripe.test_publishable_key", Value = "pk_0I1ZVgGP3mF1JfBAWfsGeM5XdGgIU" }) .Row(new { Key = "cohort.stripe.test_secret_key", Value = "sk_0I1Z2wWDHLUfrBhUk7kdA4vbNig6M" }) .Row(new { Key = "cohort.stripe.live_publishable_key", Value = "[None]" }) .Row(new { Key = "cohort.stripe.live_secret_key", Value = "[None]" }) .Row(new { Key = "cohort.stripe.capture_card_on_signup", Value = "true" })); }
public static IInsertDataSyntax Rows(this IInsertDataOrInSchemaSyntax table, IList <object> rows) { IInsertDataSyntax row = null; foreach (var entry in rows) { row = row == null?table.Row(entry) : row.Row(entry); } return(row); }
public static IInsertDataSyntax SetEmail(this IInsertDataSyntax root) { return(root .Row(new { Key = "cohort.email.test_mode", Value = "true" }) .Row(new { Key = "cohort.email.test_provider", Value = "directory" }) .Row(new { Key = "cohort.email.test_provider_key", Value = "~/Pickup" }) .Row(new { Key = "cohort.email.live_provider", Value = "postmark" }) .Row(new { Key = "cohort.email.live_provider_key", Value = "6c678123-90b2-40e0-a78f-13a434dc67fe" }) .Row(new { Key = "cohort.email.from_address", Value = "*****@*****.**" }) .Row(new { Key = "cohort.email.activation_subject", Value = "[cohort] Activate your account" }) .Row(new { Key = "cohort.email.activation_template", Value = "/Views/Email/Activation.liquid" }) .Row(new { Key = "cohort.email.reset_subject", Value = "[cohort] Reset your password" }) .Row(new { Key = "cohort.email.reset_template", Value = "/Views/Email/ResetPassword.liquid" }) .Row(new { Key = "cohort.email.contact_subject", Value = "[cohort] Contact email received" }) .Row(new { Key = "cohort.email.contact_template", Value = "/Views/Email/Contact.liquid" })); }
/// <summary> /// Set the additional feature for overriding identity values with the specified <see cref="PostgresOverridingIdentityValuesType"/> /// on the provided <see cref="IInsertDataSyntax"/> expression /// </summary> /// <exception cref="InvalidOperationException"></exception> private static IInsertDataSyntax SetOverridingIdentityValues( IInsertDataSyntax expression, PostgresOverridingIdentityValuesType overridingType, string callingMethod) { if (!(expression is ISupportAdditionalFeatures castExpression)) { throw new InvalidOperationException( string.Format( ErrorMessages.MethodXMustBeCalledOnObjectImplementingY, callingMethod, nameof(ISupportAdditionalFeatures))); } castExpression.SetAdditionalFeature(OverridingIdentityValues, overridingType); return(expression); }
/// <summary> /// Adds an OVERRIDING USER VALUE clause in the current <see cref="IInsertDataSyntax"/> expression. /// Any user-specified values will be ignored and the system-generated values will be applied /// for identity columns defined as <c>GENERATED BY DEFAULT</c> /// </summary> /// <param name="expression">The current <see cref="IInsertDataSyntax"/> expression</param> /// <returns>The current <see cref="IInsertDataSyntax"/> expression</returns> public static IInsertDataSyntax WithOverridingUserValue(this IInsertDataSyntax expression) => SetOverridingIdentityValues(expression, PostgresOverridingIdentityValuesType.User, nameof(WithOverridingUserValue));