Build with PS - fix
This commit is contained in:
@@ -154,6 +154,7 @@ function Compile-Umbraco
|
||||
&$uenv.VisualStudio.MsBuild "$src\Umbraco.Web.UI\Umbraco.Web.UI.csproj" `
|
||||
/p:WarningLevel=0 `
|
||||
/p:Configuration=$buildConfiguration `
|
||||
/p:Platform=AnyCPU `
|
||||
/p:UseWPP_CopyWebApplication=True `
|
||||
/p:PipelineDependsOnBuild=False `
|
||||
/p:OutDir=$tmp\bin\\ `
|
||||
@@ -230,6 +231,7 @@ function Compile-Tests
|
||||
&$uenv.VisualStudio.MsBuild "$src\Umbraco.Tests\Umbraco.Tests.csproj" `
|
||||
/p:WarningLevel=0 `
|
||||
/p:Configuration=$buildConfiguration `
|
||||
/p:Platform=AnyCPU `
|
||||
/p:UseWPP_CopyWebApplication=True `
|
||||
/p:PipelineDependsOnBuild=False `
|
||||
/p:OutDir=$out\\ `
|
||||
|
||||
@@ -12,6 +12,17 @@ namespace Umbraco.Tests.Dependencies
|
||||
[TestFixture]
|
||||
public class NuGet
|
||||
{
|
||||
// note
|
||||
// these tests assume that the test suite runs from the project's ~/bin directory
|
||||
// instead, we want to be able to pass the required paths as parameters
|
||||
// NUnit 3.x supports TestContext.TestParameters, alas we are still running 2.x
|
||||
//
|
||||
// so instead
|
||||
//
|
||||
// furthermore, all these tests should be parts of the build and fail the build
|
||||
// in case the NuGet things are not consisted. Also, v8 uses <PackageReference>
|
||||
// wherever possible so we will also have to deal with it eventually.
|
||||
|
||||
[Test]
|
||||
public void NuGet_Package_Versions_Are_The_Same_In_All_Package_Config_Files()
|
||||
{
|
||||
@@ -40,21 +51,20 @@ namespace Umbraco.Tests.Dependencies
|
||||
[Test]
|
||||
public void NuSpec_File_Matches_Installed_Dependencies()
|
||||
{
|
||||
var solutionDirectory = GetSolutionDirectory();
|
||||
Assert.NotNull(solutionDirectory);
|
||||
Assert.NotNull(solutionDirectory.Parent);
|
||||
|
||||
var nuSpecPath = solutionDirectory.Parent.FullName + "\\build\\NuSpecs\\";
|
||||
Assert.IsTrue(Directory.Exists(nuSpecPath));
|
||||
var nuspecsDirectory = NuSpecsDirectory;
|
||||
Assert.IsNotNull(nuspecsDirectory);
|
||||
|
||||
var packagesAndVersions = GetNuGetPackagesInSolution();
|
||||
var failTest = false;
|
||||
Assert.IsTrue(packagesAndVersions.Any());
|
||||
|
||||
var nuSpecFiles = Directory.GetFiles(nuSpecPath);
|
||||
foreach (var fileName in nuSpecFiles.Where(x => x.EndsWith("nuspec")))
|
||||
Console.WriteLine("NuSpecs: " + nuspecsDirectory.FullName);
|
||||
|
||||
var failTest = false;
|
||||
var nuspecFiles = nuspecsDirectory.GetFiles().Where(x => x.Extension == ".nuspec").Select(x => x.FullName);
|
||||
foreach (var filename in nuspecFiles)
|
||||
{
|
||||
var serializer = new XmlSerializer(typeof(NuSpec));
|
||||
using (var reader = new StreamReader(fileName))
|
||||
using (var reader = new StreamReader(filename))
|
||||
{
|
||||
var nuspec = (NuSpec)serializer.Deserialize(reader);
|
||||
var dependencies = nuspec.MetaData.dependencies;
|
||||
@@ -66,11 +76,11 @@ namespace Umbraco.Tests.Dependencies
|
||||
var dependencyMinimumVersion = dependencyVersionRange.First().Trim();
|
||||
|
||||
var matchingPackages = packagesAndVersions.Where(x => string.Equals(x.PackageName, dependency.Id,
|
||||
StringComparison.InvariantCultureIgnoreCase)).ToList();
|
||||
StringComparison.InvariantCultureIgnoreCase)).ToList();
|
||||
if (matchingPackages.Any() == false)
|
||||
continue;
|
||||
|
||||
// NuGet_Package_Versions_Are_The_Same_In_All_Package_Config_Files test
|
||||
// NuGet_Package_Versions_Are_The_Same_In_All_Package_Config_Files test
|
||||
// guarantees that all packages have one version, solutionwide, so it's okay to take First() here
|
||||
if (dependencyMinimumVersion != matchingPackages.First().PackageVersion)
|
||||
{
|
||||
@@ -88,15 +98,14 @@ namespace Umbraco.Tests.Dependencies
|
||||
private List<PackageVersionMatcher> GetNuGetPackagesInSolution()
|
||||
{
|
||||
var packagesAndVersions = new List<PackageVersionMatcher>();
|
||||
var solutionDirectory = GetSolutionDirectory();
|
||||
if (solutionDirectory == null)
|
||||
return packagesAndVersions;
|
||||
var sourceDirectory = SourceDirectory;
|
||||
if (sourceDirectory == null) return packagesAndVersions;
|
||||
|
||||
var packageConfigFiles = new List<FileInfo>();
|
||||
var packageDirectories =
|
||||
solutionDirectory.GetDirectories().Where(x =>
|
||||
x.Name.StartsWith("Umbraco.Tests") == false &&
|
||||
x.Name.StartsWith("Umbraco.MSBuild.Tasks") == false).ToArray();
|
||||
sourceDirectory.GetDirectories().Where(x =>
|
||||
x.Name.StartsWith("Umbraco.Tests") == false &&
|
||||
x.Name.StartsWith("Umbraco.MSBuild.Tasks") == false).ToArray();
|
||||
|
||||
foreach (var directory in packageDirectories)
|
||||
{
|
||||
@@ -123,15 +132,53 @@ namespace Umbraco.Tests.Dependencies
|
||||
return packagesAndVersions;
|
||||
}
|
||||
|
||||
private DirectoryInfo GetSolutionDirectory()
|
||||
private DirectoryInfo SourceDirectory
|
||||
{
|
||||
var testsDirectory = new FileInfo(TestHelper.MapPathForTest("~/"));
|
||||
if (testsDirectory.Directory == null)
|
||||
return null;
|
||||
if (testsDirectory.Directory.Parent == null || testsDirectory.Directory.Parent.Parent == null)
|
||||
return null;
|
||||
var solutionDirectory = testsDirectory.Directory.Parent.Parent.Parent;
|
||||
return solutionDirectory;
|
||||
get
|
||||
{
|
||||
// UMBRACO_TMP is set by VSTS and points to build.tmp
|
||||
var tmp = Environment.GetEnvironmentVariable("UMBRACO_TMP");
|
||||
if (tmp == null) return SolutionDirectory;
|
||||
|
||||
var path = Path.Combine(tmp, "..\\src");
|
||||
path = Path.GetFullPath(path); // sanitize
|
||||
var dir = new DirectoryInfo(path);
|
||||
return dir.Exists ? dir : null;
|
||||
}
|
||||
}
|
||||
|
||||
private DirectoryInfo NuSpecsDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
// UMBRACO_TMP is set by VSTS and points to build.tmp
|
||||
var tmp = Environment.GetEnvironmentVariable("UMBRACO_TMP");
|
||||
if (tmp == null)
|
||||
{
|
||||
var solutionDirectory = SolutionDirectory;
|
||||
if (solutionDirectory == null) return null;
|
||||
return new DirectoryInfo(Path.Combine(solutionDirectory.FullName, "..\\build\\NuSpecs"));
|
||||
}
|
||||
|
||||
var path = Path.Combine(tmp, "..\\build\\NuSpecs");
|
||||
path = Path.GetFullPath(path); // sanitize
|
||||
var dir = new DirectoryInfo(path);
|
||||
return dir.Exists ? dir : null;
|
||||
}
|
||||
}
|
||||
|
||||
private DirectoryInfo SolutionDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
var testsDirectory = new FileInfo(TestHelper.MapPathForTest("~/"));
|
||||
if (testsDirectory.Directory == null)
|
||||
return null;
|
||||
if (testsDirectory.Directory.Parent == null || testsDirectory.Directory.Parent.Parent == null)
|
||||
return null;
|
||||
var solutionDirectory = testsDirectory.Directory.Parent.Parent.Parent;
|
||||
return solutionDirectory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,5 +233,4 @@ namespace Umbraco.Tests.Dependencies
|
||||
[XmlAttribute(AttributeName = "version")]
|
||||
public string Version { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,29 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data.Common;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Moq;
|
||||
using NPoco;
|
||||
using NUnit.Framework;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.SqlSyntax;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Tests.TestHelpers;
|
||||
using Umbraco.Tests.TestHelpers.Entities;
|
||||
using Umbraco.Core.Persistence.Mappers;
|
||||
using Umbraco.Core.Persistence.Querying;
|
||||
using Umbraco.Core.Scoping;
|
||||
using Umbraco.Tests.Testing;
|
||||
|
||||
namespace Umbraco.Tests.Services
|
||||
{
|
||||
// these tests tend to fail from time to time esp. on VSTS
|
||||
//
|
||||
// read
|
||||
// Lock Time-out: https://technet.microsoft.com/en-us/library/ms172402.aspx?f=255&MSPPError=-2147217396
|
||||
// http://support.x-tensive.com/question/5242/strange-locking-exceptions-with-sqlserverce
|
||||
// http://debuggingblog.com/wp/2009/05/07/high-cpu-usage-and-windows-forms-application-hang-with-sqlce-database-and-the-sqlcelocktimeoutexception/
|
||||
//
|
||||
// tried to increase it via connection string or via SET LOCK_TIMEOUT
|
||||
// but still, the test fails on VSTS in most cases, so now ignoring it,
|
||||
// as I could not figure out _why_ and it does not look like we are
|
||||
// causing it, getting into __sysObjects locks, no idea why
|
||||
|
||||
[TestFixture, RequiresSTA]
|
||||
[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest)]
|
||||
public class ThreadSafetyServiceTest : TestWithDatabaseBase
|
||||
@@ -34,63 +35,107 @@ namespace Umbraco.Tests.Services
|
||||
CreateTestData();
|
||||
}
|
||||
|
||||
// not sure this is doing anything really
|
||||
protected override string GetDbConnectionString()
|
||||
{
|
||||
// need a longer timeout for tests?
|
||||
return base.GetDbConnectionString() + "default lock timeout=60000;";
|
||||
}
|
||||
|
||||
private const int MaxThreadCount = 20;
|
||||
|
||||
private void Save(ContentService service, IContent content)
|
||||
{
|
||||
using (var scope = ScopeProvider.CreateScope())
|
||||
{
|
||||
scope.Database.Execute("SET LOCK_TIMEOUT 60000");
|
||||
service.Save(content);
|
||||
scope.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
private void Save(MediaService service, IMedia media)
|
||||
{
|
||||
using (var scope = ScopeProvider.CreateScope())
|
||||
{
|
||||
scope.Database.Execute("SET LOCK_TIMEOUT 60000");
|
||||
service.Save(media);
|
||||
scope.Complete();
|
||||
}
|
||||
}
|
||||
|
||||
private ManualResetEventSlim TraceLocks()
|
||||
{
|
||||
var done = new ManualResetEventSlim(false);
|
||||
|
||||
// comment out to trace locks
|
||||
return done;
|
||||
|
||||
new Thread(() =>
|
||||
{
|
||||
using (var scope = ScopeProvider.CreateScope())
|
||||
while (done.IsSet == false)
|
||||
{
|
||||
var db = scope.Database;
|
||||
var info = db.Query<dynamic>("SELECT * FROM sys.lock_information;");
|
||||
Console.WriteLine("LOCKS:");
|
||||
foreach (var row in info)
|
||||
{
|
||||
Console.WriteLine("> " + row.request_spid + " " + row.resource_type + " " + row.resource_description + " " + row.request_mode + " " + row.resource_table + " " + row.resource_table_id + " " + row.request_status);
|
||||
}
|
||||
Thread.Sleep(50);
|
||||
}
|
||||
}).Start();
|
||||
return done;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Ensure_All_Threads_Execute_Successfully_Content_Service()
|
||||
{
|
||||
var contentService = (ContentService) ServiceContext.ContentService;
|
||||
if (Environment.GetEnvironmentVariable("UMBRACO_TMP") != null)
|
||||
Assert.Ignore("Do not run on VSTS.");
|
||||
|
||||
// the ServiceContext in that each repository in a service (i.e. ContentService) is a singleton
|
||||
var contentService = (ContentService)ServiceContext.ContentService;
|
||||
|
||||
var threads = new List<Thread>();
|
||||
var exceptions = new List<Exception>();
|
||||
|
||||
Debug.WriteLine("Starting...");
|
||||
|
||||
var done = TraceLocks();
|
||||
|
||||
for (var i = 0; i < MaxThreadCount; i++)
|
||||
{
|
||||
var t = new Thread(() =>
|
||||
{
|
||||
using (var scope = ScopeProvider.CreateScope())
|
||||
{
|
||||
try
|
||||
{
|
||||
Debug.WriteLine("[{0}] Running...", Thread.CurrentThread.ManagedThreadId);
|
||||
try
|
||||
{
|
||||
Debug.WriteLine("[{0}] Running...", Thread.CurrentThread.ManagedThreadId);
|
||||
|
||||
var database = scope.Database;
|
||||
Debug.WriteLine("[{0}] Database {1}.", Thread.CurrentThread.ManagedThreadId, database.InstanceId);
|
||||
var name1 = "test-" + Guid.NewGuid();
|
||||
var content1 = contentService.CreateContent(name1, -1, "umbTextpage");
|
||||
|
||||
//Debug.WriteLine($"[{Thread.CurrentThread.ManagedThreadId}] ({DateTime.Now.ToString("HH:mm:ss,FFF")}) Create 1st content.");
|
||||
var content1 = contentService.CreateContent("test" + Guid.NewGuid(), -1, "umbTextpage", 0);
|
||||
Debug.WriteLine("[{0}] Saving content #1.", Thread.CurrentThread.ManagedThreadId);
|
||||
Save(contentService, content1);
|
||||
|
||||
Debug.WriteLine("[{0}] Saving content #1.", Thread.CurrentThread.ManagedThreadId);
|
||||
//Debug.WriteLine($"[{Thread.CurrentThread.ManagedThreadId}] ({DateTime.Now.ToString("HH:mm:ss,FFF")}) Save 1st content.");
|
||||
contentService.Save(content1);
|
||||
//Debug.WriteLine($"[{Thread.CurrentThread.ManagedThreadId}] ({DateTime.Now.ToString("HH:mm:ss,FFF")}) Saved 1st content.");
|
||||
Thread.Sleep(100); //quick pause for maximum overlap!
|
||||
|
||||
Thread.Sleep(100); //quick pause for maximum overlap!
|
||||
var name2 = "test-" + Guid.NewGuid();
|
||||
var content2 = contentService.CreateContent(name2, -1, "umbTextpage");
|
||||
|
||||
//Debug.WriteLine($"[{Thread.CurrentThread.ManagedThreadId}] ({DateTime.Now.ToString("HH:mm:ss,FFF")}) Create 2nd content.");
|
||||
var content2 = contentService.CreateContent("test" + Guid.NewGuid(), -1, "umbTextpage", 0);
|
||||
|
||||
//Debug.WriteLine($"[{Thread.CurrentThread.ManagedThreadId}] ({DateTime.Now.ToString("HH:mm:ss,FFF")}) Save 2nd content.");
|
||||
Debug.WriteLine("[{0}] Saving content #2.", Thread.CurrentThread.ManagedThreadId);
|
||||
contentService.Save(content2);
|
||||
//Debug.WriteLine($"[{Thread.CurrentThread.ManagedThreadId}] ({DateTime.Now.ToString("HH:mm:ss,FFF")}) Saved 2nd content.");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//Debug.WriteLine($"[{Thread.CurrentThread.ManagedThreadId}] ({DateTime.Now.ToString("HH:mm:ss,FFF")}) Exception!");
|
||||
lock (exceptions) { exceptions.Add(e); }
|
||||
}
|
||||
|
||||
scope.Complete();
|
||||
Debug.WriteLine("[{0}] Saving content #2.", Thread.CurrentThread.ManagedThreadId);
|
||||
Save(contentService, content2);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
lock (exceptions) { exceptions.Add(e); }
|
||||
}
|
||||
});
|
||||
threads.Add(t);
|
||||
}
|
||||
|
||||
// start all threads
|
||||
// dont need SafeCallContext since db is threadstatic
|
||||
Debug.WriteLine("Starting threads");
|
||||
threads.ForEach(x => x.Start());
|
||||
|
||||
@@ -98,16 +143,14 @@ namespace Umbraco.Tests.Services
|
||||
Debug.WriteLine("Joining threads");
|
||||
threads.ForEach(x => x.Join());
|
||||
|
||||
// kill them all
|
||||
// uh? no!
|
||||
//threads.ForEach(x => x.Abort());
|
||||
done.Set();
|
||||
|
||||
Debug.WriteLine("Checking exceptions");
|
||||
if (exceptions.Count == 0)
|
||||
{
|
||||
//now look up all items, there should be 40!
|
||||
var items = contentService.GetRootContent();
|
||||
Assert.AreEqual(40, items.Count());
|
||||
Assert.AreEqual(2 * MaxThreadCount, items.Count());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -118,7 +161,9 @@ namespace Umbraco.Tests.Services
|
||||
[Test]
|
||||
public void Ensure_All_Threads_Execute_Successfully_Media_Service()
|
||||
{
|
||||
//we will mimick the ServiceContext in that each repository in a service (i.e. ContentService) is a singleton
|
||||
if (Environment.GetEnvironmentVariable("UMBRACO_TMP") != null)
|
||||
Assert.Ignore("Do not run on VSTS.");
|
||||
// mimick the ServiceContext in that each repository in a service (i.e. ContentService) is a singleton
|
||||
var mediaService = (MediaService)ServiceContext.MediaService;
|
||||
|
||||
var threads = new List<Thread>();
|
||||
@@ -126,38 +171,32 @@ namespace Umbraco.Tests.Services
|
||||
|
||||
Debug.WriteLine("Starting...");
|
||||
|
||||
var done = TraceLocks();
|
||||
|
||||
for (var i = 0; i < MaxThreadCount; i++)
|
||||
{
|
||||
var t = new Thread(() =>
|
||||
{
|
||||
using (var scope = ScopeProvider.CreateScope())
|
||||
{
|
||||
try
|
||||
{
|
||||
Debug.WriteLine("[{0}] Running...", Thread.CurrentThread.ManagedThreadId);
|
||||
try
|
||||
{
|
||||
Debug.WriteLine("[{0}] Running...", Thread.CurrentThread.ManagedThreadId);
|
||||
|
||||
var database = scope.Database;
|
||||
Debug.WriteLine("[{0}] Database {1}.", Thread.CurrentThread.ManagedThreadId, database.InstanceId);
|
||||
var name1 = "test-" + Guid.NewGuid();
|
||||
var media1 = mediaService.CreateMedia(name1, -1, Constants.Conventions.MediaTypes.Folder);
|
||||
Debug.WriteLine("[{0}] Saving media #1.", Thread.CurrentThread.ManagedThreadId);
|
||||
Save(mediaService, media1);
|
||||
|
||||
//create 2 content items
|
||||
Thread.Sleep(100); //quick pause for maximum overlap!
|
||||
|
||||
var folder1 = mediaService.CreateMedia("test" + Guid.NewGuid(), -1, Constants.Conventions.MediaTypes.Folder, 0);
|
||||
Debug.WriteLine("[{0}] Saving content #1.", Thread.CurrentThread.ManagedThreadId);
|
||||
mediaService.Save(folder1, 0);
|
||||
|
||||
Thread.Sleep(100); //quick pause for maximum overlap!
|
||||
|
||||
var folder2 = mediaService.CreateMedia("test" + Guid.NewGuid(), -1, Constants.Conventions.MediaTypes.Folder, 0);
|
||||
Debug.WriteLine("[{0}] Saving content #2.", Thread.CurrentThread.ManagedThreadId);
|
||||
mediaService.Save(folder2, 0);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
lock (exceptions) { exceptions.Add(e); }
|
||||
}
|
||||
|
||||
scope.Complete();
|
||||
}
|
||||
var name2 = "test-" + Guid.NewGuid();
|
||||
var media2 = mediaService.CreateMedia(name2, -1, Constants.Conventions.MediaTypes.Folder);
|
||||
Debug.WriteLine("[{0}] Saving media #2.", Thread.CurrentThread.ManagedThreadId);
|
||||
Save(mediaService, media2);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
lock (exceptions) { exceptions.Add(e); }
|
||||
}
|
||||
});
|
||||
threads.Add(t);
|
||||
}
|
||||
@@ -168,15 +207,13 @@ namespace Umbraco.Tests.Services
|
||||
//wait for all to complete
|
||||
threads.ForEach(x => x.Join());
|
||||
|
||||
//kill them all
|
||||
// uh? no!
|
||||
//threads.ForEach(x => x.Abort());
|
||||
done.Set();
|
||||
|
||||
if (exceptions.Count == 0)
|
||||
{
|
||||
//now look up all items, there should be 40!
|
||||
// now look up all items, there should be 40!
|
||||
var items = mediaService.GetRootMedia();
|
||||
Assert.AreEqual(40, items.Count());
|
||||
Assert.AreEqual(2 * MaxThreadCount, items.Count());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -187,83 +224,10 @@ namespace Umbraco.Tests.Services
|
||||
|
||||
public void CreateTestData()
|
||||
{
|
||||
//Create and Save ContentType "umbTextpage" -> 1045
|
||||
ContentType contentType = MockedContentTypes.CreateSimpleContentType("umbTextpage", "Textpage");
|
||||
// Create and Save ContentType "umbTextpage" -> 1045
|
||||
var contentType = MockedContentTypes.CreateSimpleContentType("umbTextpage", "Textpage");
|
||||
contentType.Key = new Guid("1D3A8E6E-2EA9-4CC1-B229-1AEE19821522");
|
||||
ServiceContext.ContentTypeService.Save(contentType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A special implementation of <see cref="IUmbracoDatabaseFactory"/> that mimics the UmbracoDatabaseFactory
|
||||
/// (one db per HttpContext) by providing one db per thread, as required for multi-threaded
|
||||
/// tests.
|
||||
/// </summary>
|
||||
internal class PerThreadSqlCeDatabaseFactory : DisposableObject, IUmbracoDatabaseFactory
|
||||
{
|
||||
// the UmbracoDatabaseFactory uses thread-static databases where there is no http context,
|
||||
// so it would need to be disposed in each thread in order for each database to be disposed,
|
||||
// instead we use this factory which also maintains one database per thread but can dispose
|
||||
// them all in one call
|
||||
|
||||
private readonly ILogger _logger;
|
||||
private readonly IMapperCollection _mappers;
|
||||
|
||||
private readonly DbProviderFactory _dbProviderFactory =
|
||||
DbProviderFactories.GetFactory(Constants.DbProviderNames.SqlCe);
|
||||
|
||||
public bool Configured => true;
|
||||
public bool CanConnect => true;
|
||||
|
||||
public void Configure(string connectionString, string providerName)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public ISqlSyntaxProvider SqlSyntax { get; } = new SqlCeSyntaxProvider();
|
||||
|
||||
public Sql<SqlContext> Sql()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public Sql<SqlContext> Sql(string sql, params object[] args)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IQuery<T> Query<T>() => new Query<T>(SqlSyntax, _mappers);
|
||||
|
||||
public DatabaseType DatabaseType => DatabaseType.SQLCe;
|
||||
|
||||
public PerThreadSqlCeDatabaseFactory(ILogger logger, IMapperCollection mappers)
|
||||
{
|
||||
_logger = logger;
|
||||
_mappers = mappers;
|
||||
}
|
||||
|
||||
private readonly ConcurrentDictionary<int, IUmbracoDatabase> _databases = new ConcurrentDictionary<int, IUmbracoDatabase>();
|
||||
|
||||
public IUmbracoDatabase Database => GetDatabase();
|
||||
|
||||
public IUmbracoDatabase GetDatabase()
|
||||
{
|
||||
var settings = ConfigurationManager.ConnectionStrings[Constants.System.UmbracoConnectionName];
|
||||
var sqlContext = new SqlContext(SqlSyntax, Mock.Of<IPocoDataFactory>(), DatabaseType);
|
||||
return _databases.GetOrAdd(Thread.CurrentThread.ManagedThreadId,
|
||||
i => new UmbracoDatabase(settings.ConnectionString, sqlContext, _dbProviderFactory, _logger));
|
||||
}
|
||||
|
||||
public IUmbracoDatabase CreateDatabase()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
protected override void DisposeResources()
|
||||
{
|
||||
// dispose the databases
|
||||
foreach (var database in _databases.Values) database.Dispose();
|
||||
_databases.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1085,23 +1085,26 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.1\x86\*.* "$(TargetDir)x86\"
|
||||
</ProjectExtensions>
|
||||
<Import Project="$(MSBuildProjectDirectory)\..\umbraco.presentation.targets" Condition="$(BuildingInsideVisualStudio) != true" />
|
||||
<Import Project="$(SolutionDir)umbraco.presentation.targets" Condition="$(BuildingInsideVisualStudio) == true" />
|
||||
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll')">
|
||||
<WebPublishingTasks>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll</WebPublishingTasks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.Tasks.dll')">
|
||||
<WebPublishingTasks>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.Tasks.dll</WebPublishingTasks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.Tasks.dll')">
|
||||
<WebPublishingTasks>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.Tasks.dll</WebPublishingTasks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.Tasks.dll')">
|
||||
<WebPublishingTasks>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.Tasks.dll</WebPublishingTasks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.Tasks.dll')">
|
||||
|
||||
<PropertyGroup Condition="$(WebPublishingTasks) == '' and Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.Tasks.dll')">
|
||||
<WebPublishingTasks>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.Tasks.dll</WebPublishingTasks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(WebPublishingTasks) == '' and Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.Tasks.dll')">
|
||||
<WebPublishingTasks>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v14.0\Web\Microsoft.Web.Publishing.Tasks.dll</WebPublishingTasks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(WebPublishingTasks) == '' and Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.Tasks.dll')">
|
||||
<WebPublishingTasks>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.Tasks.dll</WebPublishingTasks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(WebPublishingTasks) == '' and Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.Tasks.dll')">
|
||||
<WebPublishingTasks>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.Tasks.dll</WebPublishingTasks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(WebPublishingTasks) == '' and Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll')">
|
||||
<WebPublishingTasks>$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.Tasks.dll</WebPublishingTasks>
|
||||
</PropertyGroup>
|
||||
|
||||
<UsingTask TaskName="TransformXml" AssemblyFile="$(WebPublishingTasks)" Condition="'$(WebPublishingTasks)' != ''" />
|
||||
<UsingTask TaskName="TransformXml" AssemblyFile="$(VSWherePath)\Microsoft\VisualStudio\v15.0\Web\Microsoft.Web.Publishing.Tasks.dll" Condition="'$(VSWherePath)' != ''" />
|
||||
|
||||
<Target Name="BeforeBuild">
|
||||
<Message Text="WebPublishingTasks: $(WebPublishingTasks)" Importance="high" />
|
||||
<Message Text="VSWherePath: $(VSWherePath)" Importance="high" />
|
||||
@@ -1114,18 +1117,18 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.1\x86\*.* "$(TargetDir)x86\"
|
||||
<!-- Create ClientDependency.config file from Template if it doesn't exist -->
|
||||
<Copy SourceFiles="$(ProjectDir)Config\ClientDependency.Release.config" DestinationFiles="$(ProjectDir)Config\ClientDependency.config" OverwriteReadOnlyFiles="true" SkipUnchangedFiles="false" Condition="!Exists('$(ProjectDir)Config\ClientDependency.config')" />
|
||||
<!-- Only runs if the Belle build folder doesn't yet exist -->
|
||||
<CallTarget Targets="BelleBuild" Condition="!Exists('$(ProjectDir)\..\Umbraco.Web.UI.Client\build')" />
|
||||
<Message Text="UmbracoBuild, skipping BelleBuild" Importance="High" Condition=" '$(UmbracoBuild)' != '' " />
|
||||
<CallTarget Targets="BelleBuild" Condition="!Exists('$(ProjectDir)\..\Umbraco.Web.UI.Client\build') and '$(UmbracoBuild)' == ''" />
|
||||
</Target>
|
||||
|
||||
<Target Name="AfterBuild">
|
||||
<Copy SourceFiles="$(ProjectDir)Web.$(Configuration).config.transformed" DestinationFiles="$(ProjectDir)Web.config" OverwriteReadOnlyFiles="true" SkipUnchangedFiles="false" Condition="$(BuildingInsideVisualStudio) == true" />
|
||||
</Target>
|
||||
<Target Name="BelleBuild" BeforeTargets="Rebuild">
|
||||
<!-- Only runs when a Rebuild is requested -->
|
||||
<ReadLinesFromFile File="$(ProjectDir)\..\..\build\UmbracoVersion.txt">
|
||||
<Output TaskParameter="Lines" PropertyName="VersionNumber" />
|
||||
</ReadLinesFromFile>
|
||||
<Exec WorkingDirectory="$(ProjectDir)\..\..\build\" Command="BuildBelle.bat $(VersionNumber)" ConsoleToMSBuild="true" IgnoreExitCode="true" ContinueOnError="WarnAndContinue" />
|
||||
|
||||
<Target Name="BelleBuild" BeforeTargets="Rebuild" Condition=" '$(UmbracoBuild)' == '' ">
|
||||
<Exec WorkingDirectory="$(ProjectDir)\..\..\" Command="powershell -ExecutionPolicy RemoteSigned -Command "&{ $env:PSModulePath = \"$pwd\build\Modules\;$env:PSModulePath\" ; Import-Module Umbraco.Build -Force -DisableNameChecking ; build-umbraco compile-belle }"" />
|
||||
</Target>
|
||||
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
|
||||
@@ -6,16 +6,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Web.UI", "Umbraco.W
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{2849E9D4-3B4E-40A3-A309-F3CB4F0E125F}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
..\build\Build.bat = ..\build\Build.bat
|
||||
..\build\Build.proj = ..\build\Build.proj
|
||||
..\build\BuildBelle.bat = ..\build\BuildBelle.bat
|
||||
..\build\build.md = ..\build\build.md
|
||||
..\build\BuildDocs.ps1 = ..\build\BuildDocs.ps1
|
||||
..\build\RevertToCleanInstall.bat = ..\build\RevertToCleanInstall.bat
|
||||
..\build\RevertToEmptyInstall.bat = ..\build\RevertToEmptyInstall.bat
|
||||
SolutionInfo.cs = SolutionInfo.cs
|
||||
umbraco.presentation.targets = umbraco.presentation.targets
|
||||
..\build\UmbracoVersion.txt = ..\build\UmbracoVersion.txt
|
||||
..\build\webpihash.txt = ..\build\webpihash.txt
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{FD962632-184C-4005-A5F3-E705D92FC645}"
|
||||
@@ -94,6 +90,18 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Tests.Benchmarks",
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Umbraco.Compat7", "Umbraco.Compat7\Umbraco.Compat7.csproj", "{185E098F-5706-4B97-B404-EB974F05F633}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{460C4687-9209-4100-AAB0-82867B592FDC}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Umbraco.Build", "Umbraco.Build", "{F80CA2F0-168E-4364-AB75-A27DDD58643D}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
..\build\Modules\Umbraco.Build\Get-UmbracoBuildEnv.ps1 = ..\build\Modules\Umbraco.Build\Get-UmbracoBuildEnv.ps1
|
||||
..\build\Modules\Umbraco.Build\Get-UmbracoVersion.ps1 = ..\build\Modules\Umbraco.Build\Get-UmbracoVersion.ps1
|
||||
..\build\Modules\Umbraco.Build\Get-VisualStudio.ps1 = ..\build\Modules\Umbraco.Build\Get-VisualStudio.ps1
|
||||
..\build\Modules\Umbraco.Build\Set-UmbracoVersion.ps1 = ..\build\Modules\Umbraco.Build\Set-UmbracoVersion.ps1
|
||||
..\build\Modules\Umbraco.Build\Umbraco.Build.psm1 = ..\build\Modules\Umbraco.Build\Umbraco.Build.psm1
|
||||
..\build\Modules\Umbraco.Build\Utilities.ps1 = ..\build\Modules\Umbraco.Build\Utilities.ps1
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -142,5 +150,7 @@ Global
|
||||
{E3F9F378-AFE1-40A5-90BD-82833375DBFE} = {227C3B55-80E5-4E7E-A802-BE16C5128B9D}
|
||||
{5B03EF4E-E0AC-4905-861B-8C3EC1A0D458} = {227C3B55-80E5-4E7E-A802-BE16C5128B9D}
|
||||
{86DEB346-089F-4106-89C8-D852B9CF2A33} = {B5BD12C1-A454-435E-8A46-FF4A364C0382}
|
||||
{460C4687-9209-4100-AAB0-82867B592FDC} = {2849E9D4-3B4E-40A3-A309-F3CB4F0E125F}
|
||||
{F80CA2F0-168E-4364-AB75-A27DDD58643D} = {460C4687-9209-4100-AAB0-82867B592FDC}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
Reference in New Issue
Block a user