Skip to content

Commit

Permalink
rename AutomaticlyCreated -> AutomaticallyCreated (with db migration)
Browse files Browse the repository at this point in the history
  • Loading branch information
fschwiet committed Nov 21, 2013
1 parent d1e4991 commit 7d10912
Show file tree
Hide file tree
Showing 13 changed files with 189 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public IEnumerable<DomainValidationResult> Validate(Guid appKey, IEnumerable<Dom
domainLicense = new DomainLicense
{
DomainName = domainName,
AutomaticlyCreated = true,
AutomaticallyCreated = true,
DomainLicenseIssued = featureLicense.Sku.CalculateDomainIssueDate(),
DomainLicenseExpires = featureLicense.Sku.CalculateAutoDomainExpiration(),
KeyBytes = featureLicense.Sku.PrivateKey.KeyBytes,
Expand Down Expand Up @@ -194,7 +194,7 @@ private void DeleteExpiredDomainLicenses()
using (var context = dataContextFactory.Create())
{
var expiredDomainLicenses = context.DomainLicenses
.AutomaticlyCreated()
.AutomaticallyCreated()
.Expired()
.ToList();

Expand Down
4 changes: 2 additions & 2 deletions src/KeyHub.Data/Extensions/DomainLicenseExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public static bool AnyEquals(this DbSet<DomainLicense> domainLicenseSet, DomainL
return domainLicenseSet.Any(x => x.DomainName == domainLicense.DomainName && x.LicenseId == domainLicense.LicenseId);
}

public static IQueryable<DomainLicense> AutomaticlyCreated(this IQueryable<DomainLicense> domainLicenses)
public static IQueryable<DomainLicense> AutomaticallyCreated(this IQueryable<DomainLicense> domainLicenses)
{
return domainLicenses.Where(x => x.AutomaticlyCreated);
return domainLicenses.Where(x => x.AutomaticallyCreated);
}

public static IQueryable<DomainLicense> Expired(this IQueryable<DomainLicense> domainLicenses)
Expand Down
7 changes: 7 additions & 0 deletions src/KeyHub.Data/KeyHub.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@
<Compile Include="Migrations\201303261006171_CountryRightsSeed.Designer.cs">
<DependentUpon>201303261006171_CountryRightsSeed.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201311212240155_RenameDomainLicenseColumn.cs" />
<Compile Include="Migrations\201311212240155_RenameDomainLicenseColumn.Designer.cs">
<DependentUpon>201311212240155_RenameDomainLicenseColumn.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\MigrationConfiguration.cs" />
<Compile Include="Migrations\Internal\DbSeederMigrator.cs" />
<Compile Include="Migrations\Internal\IMigrationDataSeeder.cs" />
Expand Down Expand Up @@ -144,6 +148,9 @@
<EmbeddedResource Include="Migrations\201303261006171_CountryRightsSeed.resx">
<DependentUpon>201303261006171_CountryRightsSeed.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201311212240155_RenameDomainLicenseColumn.resx">
<DependentUpon>201311212240155_RenameDomainLicenseColumn.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
namespace KeyHub.Data.Migrations
{
using System;
using System.Data.Entity.Migrations;

public partial class RenameDomainLicenseColumn : DbMigration
{
public override void Up()
{
RenameColumn("dbo.DomainLicenses", "AutomaticlyCreated", "AutomaticallyCreated");
}

public override void Down()
{
RenameColumn("dbo.DomainLicenses", "AutomaticallyCreated", "AutomaticlyCreated");
}
}
}

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/KeyHub.Model/Definition/Application/DomainLicense.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public partial class DomainLicense : IModelItem
/// Should be true if automatically generated
/// </summary>
[Required]
public bool AutomaticlyCreated { get; set; }
public bool AutomaticallyCreated { get; set; }

/// <summary>
/// The private key in bytes, encrypted with KeyHub.Common.SymmetricEncryption.EncryptForDatabase
Expand Down
4 changes: 2 additions & 2 deletions src/KeyHub.Model/Logic/Application/DomainLicense.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ public bool CanBeManuallyDeleted
{
get
{
return (AutomaticlyCreated && License.Sku.CanDeleteAutoDomains) ||
(!AutomaticlyCreated && License.Sku.CanDeleteManualDomains);
return (AutomaticallyCreated && License.Sku.CanDeleteAutoDomains) ||
(!AutomaticallyCreated && License.Sku.CanDeleteManualDomains);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
// .IgnoreInstance()
// .ReturnsCollection(new List<License> { license1 });

// Mock.Arrange(() => context.DomainLicenses.Add(Arg.Matches((DomainLicense d) => d.DomainName == domainName1 && d.AutomaticlyCreated)))
// Mock.Arrange(() => context.DomainLicenses.Add(Arg.Matches((DomainLicense d) => d.DomainName == domainName1 && d.AutomaticallyCreated)))
// .IgnoreInstance()
// .DoInstead((DomainLicense d) => domainLicenses.Add(d));

Expand Down
4 changes: 2 additions & 2 deletions src/KeyHub.Web/Controllers/DomainLicenseController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public ActionResult Create(DomainLicenseViewModel viewModel)
domainLicense.DomainName = viewModel.DomainName;
domainLicense.DomainLicenseIssued = viewModel.DomainLicenseIssued;
domainLicense.DomainLicenseExpires = viewModel.DomainLicenseExpires;
domainLicense.AutomaticlyCreated = viewModel.AutomaticlyCreated;
domainLicense.AutomaticallyCreated = viewModel.AutomaticallyCreated;

context.DomainLicenses.Add(domainLicense);

Expand Down Expand Up @@ -172,7 +172,7 @@ public ActionResult Edit(DomainLicenseViewModel viewModel)
domainLicense.DomainName = viewModel.DomainName;
domainLicense.DomainLicenseIssued = viewModel.DomainLicenseIssued;
domainLicense.DomainLicenseExpires = viewModel.DomainLicenseExpires;
domainLicense.AutomaticlyCreated = viewModel.AutomaticlyCreated;
domainLicense.AutomaticallyCreated = viewModel.AutomaticallyCreated;

context.SaveChanges();
Flash.Success("The domain license was updated.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public DomainLicenseViewModel(Model.DomainLicense domainLicense)
this.DomainName = domainLicense.DomainName;
this.DomainLicenseIssued = domainLicense.DomainLicenseIssued;
this.DomainLicenseExpires = domainLicense.DomainLicenseExpires;
this.AutomaticlyCreated = domainLicense.AutomaticlyCreated;
this.AutomaticallyCreated = domainLicense.AutomaticallyCreated;
this.CanBeManuallyDeleted = domainLicense.CanBeManuallyDeleted;
this.CanCalculateDomainExpiration = domainLicense.License.Sku.CanCalculateManualDomainExpiration;
}
Expand Down Expand Up @@ -72,7 +72,7 @@ public DomainLicenseViewModel(Model.DomainLicense domainLicense)
/// Should be true if automatically generated
/// </summary>
[Required]
public bool AutomaticlyCreated { get; set; }
public bool AutomaticallyCreated { get; set; }

/// <summary>
/// The license name this domains is associated with
Expand Down
2 changes: 1 addition & 1 deletion src/KeyHub.Web/Views/DomainLicense/Create.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<legend>DomainLicenseViewModel</legend>

@Html.HiddenFor(model => model.DomainLicenseId)
@Html.HiddenFor(model => model.AutomaticlyCreated)
@Html.HiddenFor(model => model.AutomaticallyCreated)
@Html.HiddenFor(model => model.LicenseId)
@Html.HiddenFor(model => model.RedirectUrl)

Expand Down
2 changes: 1 addition & 1 deletion src/KeyHub.Web/Views/DomainLicense/Edit.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<legend>DomainLicenseViewModel</legend>

@Html.HiddenFor(model => model.DomainLicenseId)
@Html.HiddenFor(model => model.AutomaticlyCreated)
@Html.HiddenFor(model => model.AutomaticallyCreated)
@Html.HiddenFor(model => model.LicenseId)
@Html.HiddenFor(model => model.RedirectUrl)

Expand Down

0 comments on commit 7d10912

Please sign in to comment.