Skip to content

Commit

Permalink
Merge pull request #2 from ErikxNilsson/master
Browse files Browse the repository at this point in the history
Update for epi 11 and .net 461
  • Loading branch information
evest authored Dec 5, 2017
2 parents 0291e13 + 60041ef commit a560f44
Show file tree
Hide file tree
Showing 13 changed files with 174 additions and 270 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,7 @@ src/BlobConverter/NuGet.exe
src/EPiCode.BlobConverter/NuGet.exe
src/EPiCode.SqlBlobProvider/EPiCode.SqlBlobProvider.1.0.0.0.nupkg
src/EPiCode.SqlBlobProvider/NuGet.exe
/src/EPiCode.SqlBlobProvider/EPiCode.SqlBlobProvider.1.5.0.nupkg
/src/EPiCode.SqlBlobProvider/app.config
/src/EPiCode.BlobConverter/app.config
/src/.vs/EPiCode.SqlBlobProvider/v15/sqlite3/storage.ide
166 changes: 60 additions & 106 deletions src/EPiCode.BlobConverter/EPiCode.BlobConverter.csproj

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/EPiCode.BlobConverter/EPiCode.BlobConverter.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>EPiCode.BlobConverter</id>
<version>1.4.2</version>
<version>1.5.2</version>
<title>EPiCode.BlobConverter</title>
<authors>Per Magne Skuseth</authors>
<owners>BV Network AS</owners>
Expand All @@ -12,10 +12,10 @@
<description>Contains a scheduled job that will convert all FileBlobs into your currently configured blob provider.</description>
<tags>EPiServer Blob</tags>
<dependencies>
<dependency id="EPiServer.Framework" version="[9.0, 11.0)" />
<dependency id="EPiServer.Framework" version="[11.2.1, 12.0)" />
</dependencies>
</metadata>
<files>
<file src="bin\$configuration$\EPiCode.BlobConverter.dll" target="lib\net45\" />
<file src="bin\$configuration$\EPiCode.BlobConverter.dll" target="lib\net461\" />
</files>
</package>
4 changes: 2 additions & 2 deletions src/EPiCode.BlobConverter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.1")]
[assembly: AssemblyFileVersion("1.4.1")]
[assembly: AssemblyVersion("1.5.2")]
[assembly: AssemblyFileVersion("1.5.2")]
26 changes: 14 additions & 12 deletions src/EPiCode.BlobConverter/packages.config
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="3.2.2" targetFramework="net45" />
<package id="Castle.Windsor" version="3.2.1" targetFramework="net45" />
<package id="EPiServer.CMS.Core" version="9.0.0" targetFramework="net45" />
<package id="EPiServer.CMS.UI" version="9.0.0" targetFramework="net45" />
<package id="EPiServer.CMS.UI.Core" version="9.0.0" targetFramework="net45" />
<package id="EPiServer.Framework" version="9.0.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="2.0.30506.0" targetFramework="net45" />
<package id="Castle.Core" version="4.2.1" targetFramework="net461" />
<package id="Castle.Windsor" version="4.1.0" targetFramework="net461" />
<package id="EPiServer.CMS.Core" version="11.2.1" targetFramework="net461" />
<package id="EPiServer.Framework" version="11.2.1" targetFramework="net461" />
<package id="Microsoft.Tpl.Dataflow" version="4.5.24" targetFramework="net461" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="5.0.8" targetFramework="net45" />
<package id="structuremap-signed" version="3.1.6.186" targetFramework="net45" />
<package id="structuremap.web-signed" version="3.1.6.186" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
<package id="System.ComponentModel.Annotations" version="4.4.0" targetFramework="net461" />
<package id="System.Data.SqlClient" version="4.4.0" targetFramework="net461" />
<package id="System.Reflection.Emit" version="4.3.0" targetFramework="net461" />
<package id="System.Security.AccessControl" version="4.4.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Xml" version="4.4.0" targetFramework="net461" />
<package id="System.Security.Permissions" version="4.4.0" targetFramework="net461" />
<package id="System.Security.Principal.Windows" version="4.4.0" targetFramework="net461" />
<package id="System.Threading.AccessControl" version="4.4.0" targetFramework="net461" />
</packages>
168 changes: 58 additions & 110 deletions src/EPiCode.SqlBlobProvider/EPiCode.SqlBlobProvider.csproj

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/EPiCode.SqlBlobProvider/EPiCode.SqlBlobProvider.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>EPiCode.SqlBlobProvider</id>
<version>$version$</version>
<version>1.5.2</version>
<title>EPiCode.SqlBlobProvider</title>
<authors>Per Magne Skuseth</authors>
<owners>BV Network AS</owners>
Expand All @@ -12,11 +12,11 @@
<description>A blob provider which stores all blobs in database</description>
<tags>EPiServer Blob</tags>
<dependencies>
<dependency id="EPiServer.Framework" version="[9.0, 11.0)" />
<dependency id="EPiServer.Framework" version="[11.2.1, 12.0)" />
</dependencies>
</metadata>
<files>
<file src="Web.config.transform" target="content" />
<file src="bin\$configuration$\EPiCode.SqlBlobProvider.dll" target="lib\net45\" />
<file src="bin\$configuration$\EPiCode.SqlBlobProvider.dll" target="lib\net461\" />
</files>
</package>
5 changes: 1 addition & 4 deletions src/EPiCode.SqlBlobProvider/NonSeekableMemoryStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ public NonSeekableMemoryStream(byte[] blob) : base(blob)
/// By always returning false, we effectively turn off
/// Episerver's async download support
/// </summary>
public override bool CanSeek
{
get { return false; }
}
public override bool CanSeek => false;
}
}
4 changes: 2 additions & 2 deletions src/EPiCode.SqlBlobProvider/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.4.2")]
[assembly: AssemblyFileVersion("1.4.2")]
[assembly: AssemblyVersion("1.5.2")]
[assembly: AssemblyFileVersion("1.5.2")]
10 changes: 6 additions & 4 deletions src/EPiCode.SqlBlobProvider/SqlBlobExportJob.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.IO;
using EPiServer.Framework.Blobs;
using EPiServer.PlugIn;
using EPiServer.ServiceLocation;

namespace EPiCode.SqlBlobProvider
{
Expand Down Expand Up @@ -32,9 +33,10 @@ public override string Execute()
}
if (saveDirectory == null)
{
var provider = BlobFactory.Instance.GetProvider(item.BlobId) as SqlBlobProvider;
if (provider != null)
var blobProviderRegistry = ServiceLocator.Current.GetInstance<IBlobProviderRegistry>();
if(blobProviderRegistry.GetProvider(item.BlobId) is SqlBlobProvider provider) {
saveDirectory = provider.Path;
}
}
var id = item.BlobId;
var path = saveDirectory + id.Segments[0] + id.Segments[1] + id.Segments[2].TrimEnd('\\');
Expand All @@ -50,9 +52,9 @@ public override string Execute()
}
exported++;
if (exported % 50 == 0)
OnStatusChanged(string.Format("Exported {0} blobs.", exported));
OnStatusChanged($"Exported {exported} blobs.");
}
string status = string.Format("Job has completed. {0} SQL blobs has been exported to {1}.", exported, saveDirectory);
string status = $"Job has completed. {exported} SQL blobs has been exported to {saveDirectory}.";
OnStatusChanged(status);
return status;
}
Expand Down
11 changes: 3 additions & 8 deletions src/EPiCode.SqlBlobProvider/SqlBlobModelRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,15 @@ namespace EPiCode.SqlBlobProvider
{
public class SqlBlobModelRepository
{
private static ILog _log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
private static readonly ILog _log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

public static SqlBlobModel Get(Uri id)
{
var blobModel = SqlBlobStore.Find<SqlBlobModel>("BlobId", id.ToString()).FirstOrDefault();
return blobModel;
}

public static DynamicDataStore SqlBlobStore
{
get
{
return DynamicDataStoreFactory.Instance.GetStore(typeof(SqlBlobModel));
}
}
public static DynamicDataStore SqlBlobStore => DynamicDataStoreFactory.Instance.GetStore(typeof(SqlBlobModel));

public static void Save(SqlBlobModel blob)
{
Expand Down
8 changes: 4 additions & 4 deletions src/EPiCode.SqlBlobProvider/SqlBlobProvider.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Runtime.Remoting.Messaging;
using EPiServer;
using EPiServer;
using EPiServer.Framework;
using EPiServer.Web;
using EPiServer.Core;
Expand All @@ -24,11 +23,13 @@ public SqlBlobProvider()
{

}

public SqlBlobProvider(string path, bool loadFromDisk)
{
LoadFromDisk = loadFromDisk;
Path = VirtualPathUtilityEx.RebasePhysicalPath(path);
}

public override void Initialize(string name, NameValueCollection config)
{
if (config.Get(PathKey) != null)
Expand All @@ -49,8 +50,7 @@ private void DeleteSqlBlobProviderFiles(object sender, DeleteContentEventArgs e)
var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
foreach (var descendant in e.DeletedDescendents)
{
MediaData mediaData;
if (contentRepository.TryGet(descendant, out mediaData))
if (contentRepository.TryGet(descendant, out MediaData mediaData))
{
FileHelper.Delete(Blob.GetContainerIdentifier(mediaData.ContentGuid), Path);
}
Expand Down
26 changes: 14 additions & 12 deletions src/EPiCode.SqlBlobProvider/packages.config
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="3.2.2" targetFramework="net45" />
<package id="Castle.Windsor" version="3.2.1" targetFramework="net45" />
<package id="EPiServer.CMS.Core" version="9.0.0" targetFramework="net45" />
<package id="EPiServer.CMS.UI.Core" version="9.0.0" targetFramework="net45" />
<package id="EPiServer.Framework" version="9.0.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="2.0.30506.0" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="5.0.8" targetFramework="net45" />
<package id="structuremap-signed" version="3.1.6.186" targetFramework="net45" />
<package id="structuremap.web-signed" version="3.1.6.186" targetFramework="net45" />
<package id="Castle.Core" version="4.2.1" targetFramework="net461" />
<package id="Castle.Windsor" version="4.1.0" targetFramework="net461" />
<package id="EPiServer.CMS.Core" version="11.2.1" targetFramework="net461" />
<package id="EPiServer.Framework" version="11.2.1" targetFramework="net461" />
<package id="Microsoft.Tpl.Dataflow" version="4.5.24" targetFramework="net461" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net461" />
<package id="System.ComponentModel.Annotations" version="4.4.0" targetFramework="net461" />
<package id="System.Data.SqlClient" version="4.4.0" targetFramework="net461" />
<package id="System.Reflection.Emit" version="4.3.0" targetFramework="net461" />
<package id="System.Security.AccessControl" version="4.4.0" targetFramework="net461" />
<package id="System.Security.Cryptography.Xml" version="4.4.0" targetFramework="net461" />
<package id="System.Security.Permissions" version="4.4.0" targetFramework="net461" />
<package id="System.Security.Principal.Windows" version="4.4.0" targetFramework="net461" />
<package id="System.Threading.AccessControl" version="4.4.0" targetFramework="net461" />
</packages>

0 comments on commit a560f44

Please sign in to comment.