This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DbConnectionBindings : NinjectModule | |
{ | |
public override void Load() | |
{ | |
Bind<MySpesificDatabaseConnection>() | |
.ToSelf() | |
.InRequestScope() | |
.WithConstructorArgument("connectionString", ConfigurationManager.ConnectionStrings["MyConnectionStringInConfig"].ConnectionString) | |
.OnDeactivation(con => con.Close()) | |
.OnActivation(con => con.Open()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span class="question" | |
rel="popover" | |
data-original-title="Tittel" | |
data-content="Beskrivelse" | |
data-trigger="hover" | |
data-placement="right"> | |
<i class="icon icon-question"></i> | |
</span> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class Elmah : DbMigration | |
{ | |
public override void Up() | |
{ | |
Sql(CreateTable_ELMAH_Error); | |
Sql(CreatreProcedure_ELMAH_GetErrorXml); | |
Sql(CreateProcedure_ELMAH_GetErrorsXml); | |
Sql(CreateProcedure_ELMAH_LogError); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BulkInsert (transaction) | |
var insert = @" | |
INSERT INTO table (value1, value2) | |
VALUES (@value1, @value1); | |
"; | |
using (var scope = new System.Transactions.TransactionScope()) | |
{ | |
_dbConnection.Open(); | |
_dbConnection.Execute(insert, listOfStuff); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var managementApiClient = new ManagementApiClient("yourManagementToken", new Uri("https://@@tenant@@.auth0.com/api/v2")); | |
dynamic appMetadata = new ExpandoObject(); | |
appMetadata.Roles = new string[] { "Administrator", "ApplicationOwner" }; | |
appMetadata.TenantId = 154; | |
managementApiClient.Users.UpdateAsync("userId", new UserUpdateRequest() | |
{ | |
Connection = "Your-Connection", | |
AppMetadata = appMetadata | |
}); |