Using OData feed as a Service Reference connection

Work Item: 16954

--HG--
branch : dev
This commit is contained in:
Sebastien Ros
2010-12-08 16:00:58 -08:00
parent 0a30addc4f
commit b43c5621ab
8 changed files with 1012 additions and 23 deletions

View File

@@ -46,7 +46,7 @@ namespace Orchard.Packaging.Controllers {
[HttpPost, ActionName("RemoveTheme")]
public ActionResult RemoveThemePOST(string themeId, string returnUrl, string retryUrl) {
return UninstallPackage(PackagingSourceManager.ThemesFilter + themeId, returnUrl, retryUrl);
return UninstallPackage(PackagingSourceManager.ThemesPrefix + themeId, returnUrl, retryUrl);
}
public ActionResult AddModule(string returnUrl) {

View File

@@ -20,7 +20,7 @@ namespace Orchard.Packaging {
public void Installed(Feature feature) {
if (feature.Descriptor.Id == "Gallery") {
_packagingSourceManager.AddSource("Orchard Extensions Gallery", "http://feed.nuget.org/ctp2/odata/v1");
_packagingSourceManager.AddSource("Orchard Extensions Gallery", "http://orchardproject.net:777/GalleryServer/FeedService.svc");
}
}

View File

@@ -40,6 +40,7 @@
<HintPath>..\..\..\..\lib\nuget\NuGet.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data.Services.Client" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ComponentModel.DataAnnotations">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -66,6 +67,11 @@
<Compile Include="Migrations.cs" />
<Compile Include="Models\PackagingSource.cs" />
<Compile Include="ResourceManifest.cs" />
<Compile Include="Service References\GalleryServer\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.datasvcmap</DependentUpon>
</Compile>
<Compile Include="Services\AtomExtensions.cs" />
<Compile Include="Services\ExtensionReferenceRepository.cs" />
<Compile Include="Services\FileBaseProjectSystem.cs" />
@@ -88,6 +94,10 @@
</ItemGroup>
<ItemGroup>
<Content Include="Module.txt" />
<None Include="Service References\GalleryServer\Reference.datasvcmap">
<Generator>DataServiceClientGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
<Content Include="Styles\orchard-packaging-admin.css" />
<Content Include="Views\Gallery\AddSource.cshtml" />
<Content Include="Views\Gallery\Modules.cshtml" />
@@ -124,6 +134,17 @@
<ItemGroup>
<Content Include="Views\PackagingServices\AddTheme.cshtml" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<ServiceReferenceMetadataStorage Include="Service References\GalleryServer\">
<Type>datasvcmap</Type>
</ServiceReferenceMetadataStorage>
</ItemGroup>
<ItemGroup>
<None Include="Service References\GalleryServer\service.edmx" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -0,0 +1,890 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// Original file name:
// Generation date: 12/8/2010 3:18:34 PM
namespace Orchard.Packaging.GalleryServer
{
/// <summary>
/// There are no comments for GalleryFeedContext in the schema.
/// </summary>
public partial class GalleryFeedContext : global::System.Data.Services.Client.DataServiceContext
{
/// <summary>
/// Initialize a new GalleryFeedContext object.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public GalleryFeedContext(global::System.Uri serviceRoot) :
base(serviceRoot)
{
this.ResolveName = new global::System.Func<global::System.Type, string>(this.ResolveNameFromType);
this.ResolveType = new global::System.Func<string, global::System.Type>(this.ResolveTypeFromName);
this.OnContextCreated();
}
partial void OnContextCreated();
/// <summary>
/// Since the namespace configured for this service reference
/// in Visual Studio is different from the one indicated in the
/// server schema, use type-mappers to map between the two.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
protected global::System.Type ResolveTypeFromName(string typeName)
{
if (typeName.StartsWith("Gallery.Infrastructure.FeedModels", global::System.StringComparison.Ordinal))
{
return this.GetType().Assembly.GetType(string.Concat("Orchard.Packaging.GalleryServer", typeName.Substring(33)), false);
}
return null;
}
/// <summary>
/// Since the namespace configured for this service reference
/// in Visual Studio is different from the one indicated in the
/// server schema, use type-mappers to map between the two.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
protected string ResolveNameFromType(global::System.Type clientType)
{
if (clientType.Namespace.Equals("Orchard.Packaging.GalleryServer", global::System.StringComparison.Ordinal))
{
return string.Concat("Gallery.Infrastructure.FeedModels.", clientType.Name);
}
return null;
}
/// <summary>
/// There are no comments for Packages in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public global::System.Data.Services.Client.DataServiceQuery<PublishedPackage> Packages
{
get
{
if ((this._Packages == null))
{
this._Packages = base.CreateQuery<PublishedPackage>("Packages");
}
return this._Packages;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private global::System.Data.Services.Client.DataServiceQuery<PublishedPackage> _Packages;
/// <summary>
/// There are no comments for Screenshots in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public global::System.Data.Services.Client.DataServiceQuery<PublishedScreenshot> Screenshots
{
get
{
if ((this._Screenshots == null))
{
this._Screenshots = base.CreateQuery<PublishedScreenshot>("Screenshots");
}
return this._Screenshots;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private global::System.Data.Services.Client.DataServiceQuery<PublishedScreenshot> _Screenshots;
/// <summary>
/// There are no comments for Packages in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public void AddToPackages(PublishedPackage publishedPackage)
{
base.AddObject("Packages", publishedPackage);
}
/// <summary>
/// There are no comments for Screenshots in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public void AddToScreenshots(PublishedScreenshot publishedScreenshot)
{
base.AddObject("Screenshots", publishedScreenshot);
}
}
/// <summary>
/// There are no comments for Gallery.Infrastructure.FeedModels.PublishedPackage in the schema.
/// </summary>
/// <KeyProperties>
/// Id
/// Version
/// </KeyProperties>
[global::System.Data.Services.Common.DataServiceKeyAttribute("Id", "Version")]
public partial class PublishedPackage
{
/// <summary>
/// Create a new PublishedPackage object.
/// </summary>
/// <param name="ID">Initial value of Id.</param>
/// <param name="version">Initial value of Version.</param>
/// <param name="downloadCount">Initial value of DownloadCount.</param>
/// <param name="packageSize">Initial value of PackageSize.</param>
/// <param name="rating">Initial value of Rating.</param>
/// <param name="ratingCount">Initial value of RatingCount.</param>
/// <param name="price">Initial value of Price.</param>
/// <param name="requireLicenseAcceptance">Initial value of RequireLicenseAcceptance.</param>
/// <param name="isLatestVersion">Initial value of IsLatestVersion.</param>
/// <param name="created">Initial value of Created.</param>
/// <param name="lastUpdated">Initial value of LastUpdated.</param>
/// <param name="published">Initial value of Published.</param>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public static PublishedPackage CreatePublishedPackage(string ID, string version, int downloadCount, long packageSize, double rating, int ratingCount, decimal price, bool requireLicenseAcceptance, bool isLatestVersion, global::System.DateTime created, global::System.DateTime lastUpdated, global::System.DateTime published)
{
PublishedPackage publishedPackage = new PublishedPackage();
publishedPackage.Id = ID;
publishedPackage.Version = version;
publishedPackage.DownloadCount = downloadCount;
publishedPackage.PackageSize = packageSize;
publishedPackage.Rating = rating;
publishedPackage.RatingCount = ratingCount;
publishedPackage.Price = price;
publishedPackage.RequireLicenseAcceptance = requireLicenseAcceptance;
publishedPackage.IsLatestVersion = isLatestVersion;
publishedPackage.Created = created;
publishedPackage.LastUpdated = lastUpdated;
publishedPackage.Published = published;
return publishedPackage;
}
/// <summary>
/// There are no comments for Property Id in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Id
{
get
{
return this._Id;
}
set
{
this.OnIdChanging(value);
this._Id = value;
this.OnIdChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Id;
partial void OnIdChanging(string value);
partial void OnIdChanged();
/// <summary>
/// There are no comments for Property Version in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Version
{
get
{
return this._Version;
}
set
{
this.OnVersionChanging(value);
this._Version = value;
this.OnVersionChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Version;
partial void OnVersionChanging(string value);
partial void OnVersionChanged();
/// <summary>
/// There are no comments for Property Title in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Title
{
get
{
return this._Title;
}
set
{
this.OnTitleChanging(value);
this._Title = value;
this.OnTitleChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Title;
partial void OnTitleChanging(string value);
partial void OnTitleChanged();
/// <summary>
/// There are no comments for Property Authors in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Authors
{
get
{
return this._Authors;
}
set
{
this.OnAuthorsChanging(value);
this._Authors = value;
this.OnAuthorsChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Authors;
partial void OnAuthorsChanging(string value);
partial void OnAuthorsChanged();
/// <summary>
/// There are no comments for Property PackageType in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string PackageType
{
get
{
return this._PackageType;
}
set
{
this.OnPackageTypeChanging(value);
this._PackageType = value;
this.OnPackageTypeChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _PackageType;
partial void OnPackageTypeChanging(string value);
partial void OnPackageTypeChanged();
/// <summary>
/// There are no comments for Property Summary in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Summary
{
get
{
return this._Summary;
}
set
{
this.OnSummaryChanging(value);
this._Summary = value;
this.OnSummaryChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Summary;
partial void OnSummaryChanging(string value);
partial void OnSummaryChanged();
/// <summary>
/// There are no comments for Property Description in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Description
{
get
{
return this._Description;
}
set
{
this.OnDescriptionChanging(value);
this._Description = value;
this.OnDescriptionChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Description;
partial void OnDescriptionChanging(string value);
partial void OnDescriptionChanged();
/// <summary>
/// There are no comments for Property DownloadCount in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public int DownloadCount
{
get
{
return this._DownloadCount;
}
set
{
this.OnDownloadCountChanging(value);
this._DownloadCount = value;
this.OnDownloadCountChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private int _DownloadCount;
partial void OnDownloadCountChanging(int value);
partial void OnDownloadCountChanged();
/// <summary>
/// There are no comments for Property Copyright in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Copyright
{
get
{
return this._Copyright;
}
set
{
this.OnCopyrightChanging(value);
this._Copyright = value;
this.OnCopyrightChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Copyright;
partial void OnCopyrightChanging(string value);
partial void OnCopyrightChanged();
/// <summary>
/// There are no comments for Property PackageHashAlgorithm in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string PackageHashAlgorithm
{
get
{
return this._PackageHashAlgorithm;
}
set
{
this.OnPackageHashAlgorithmChanging(value);
this._PackageHashAlgorithm = value;
this.OnPackageHashAlgorithmChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _PackageHashAlgorithm;
partial void OnPackageHashAlgorithmChanging(string value);
partial void OnPackageHashAlgorithmChanged();
/// <summary>
/// There are no comments for Property PackageHash in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string PackageHash
{
get
{
return this._PackageHash;
}
set
{
this.OnPackageHashChanging(value);
this._PackageHash = value;
this.OnPackageHashChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _PackageHash;
partial void OnPackageHashChanging(string value);
partial void OnPackageHashChanged();
/// <summary>
/// There are no comments for Property PackageSize in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public long PackageSize
{
get
{
return this._PackageSize;
}
set
{
this.OnPackageSizeChanging(value);
this._PackageSize = value;
this.OnPackageSizeChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private long _PackageSize;
partial void OnPackageSizeChanging(long value);
partial void OnPackageSizeChanged();
/// <summary>
/// There are no comments for Property Rating in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public double Rating
{
get
{
return this._Rating;
}
set
{
this.OnRatingChanging(value);
this._Rating = value;
this.OnRatingChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private double _Rating;
partial void OnRatingChanging(double value);
partial void OnRatingChanged();
/// <summary>
/// There are no comments for Property RatingCount in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public int RatingCount
{
get
{
return this._RatingCount;
}
set
{
this.OnRatingCountChanging(value);
this._RatingCount = value;
this.OnRatingCountChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private int _RatingCount;
partial void OnRatingCountChanging(int value);
partial void OnRatingCountChanged();
/// <summary>
/// There are no comments for Property Price in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public decimal Price
{
get
{
return this._Price;
}
set
{
this.OnPriceChanging(value);
this._Price = value;
this.OnPriceChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private decimal _Price;
partial void OnPriceChanging(decimal value);
partial void OnPriceChanged();
/// <summary>
/// There are no comments for Property RequireLicenseAcceptance in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public bool RequireLicenseAcceptance
{
get
{
return this._RequireLicenseAcceptance;
}
set
{
this.OnRequireLicenseAcceptanceChanging(value);
this._RequireLicenseAcceptance = value;
this.OnRequireLicenseAcceptanceChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private bool _RequireLicenseAcceptance;
partial void OnRequireLicenseAcceptanceChanging(bool value);
partial void OnRequireLicenseAcceptanceChanged();
/// <summary>
/// There are no comments for Property IsLatestVersion in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public bool IsLatestVersion
{
get
{
return this._IsLatestVersion;
}
set
{
this.OnIsLatestVersionChanging(value);
this._IsLatestVersion = value;
this.OnIsLatestVersionChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private bool _IsLatestVersion;
partial void OnIsLatestVersionChanging(bool value);
partial void OnIsLatestVersionChanged();
/// <summary>
/// There are no comments for Property Created in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public global::System.DateTime Created
{
get
{
return this._Created;
}
set
{
this.OnCreatedChanging(value);
this._Created = value;
this.OnCreatedChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private global::System.DateTime _Created;
partial void OnCreatedChanging(global::System.DateTime value);
partial void OnCreatedChanged();
/// <summary>
/// There are no comments for Property LastUpdated in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public global::System.DateTime LastUpdated
{
get
{
return this._LastUpdated;
}
set
{
this.OnLastUpdatedChanging(value);
this._LastUpdated = value;
this.OnLastUpdatedChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private global::System.DateTime _LastUpdated;
partial void OnLastUpdatedChanging(global::System.DateTime value);
partial void OnLastUpdatedChanged();
/// <summary>
/// There are no comments for Property Published in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public global::System.DateTime Published
{
get
{
return this._Published;
}
set
{
this.OnPublishedChanging(value);
this._Published = value;
this.OnPublishedChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private global::System.DateTime _Published;
partial void OnPublishedChanging(global::System.DateTime value);
partial void OnPublishedChanged();
/// <summary>
/// There are no comments for Property ExternalPackageUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string ExternalPackageUrl
{
get
{
return this._ExternalPackageUrl;
}
set
{
this.OnExternalPackageUrlChanging(value);
this._ExternalPackageUrl = value;
this.OnExternalPackageUrlChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _ExternalPackageUrl;
partial void OnExternalPackageUrlChanging(string value);
partial void OnExternalPackageUrlChanged();
/// <summary>
/// There are no comments for Property ProjectUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string ProjectUrl
{
get
{
return this._ProjectUrl;
}
set
{
this.OnProjectUrlChanging(value);
this._ProjectUrl = value;
this.OnProjectUrlChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _ProjectUrl;
partial void OnProjectUrlChanging(string value);
partial void OnProjectUrlChanged();
/// <summary>
/// There are no comments for Property LicenseUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string LicenseUrl
{
get
{
return this._LicenseUrl;
}
set
{
this.OnLicenseUrlChanging(value);
this._LicenseUrl = value;
this.OnLicenseUrlChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _LicenseUrl;
partial void OnLicenseUrlChanging(string value);
partial void OnLicenseUrlChanged();
/// <summary>
/// There are no comments for Property IconUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string IconUrl
{
get
{
return this._IconUrl;
}
set
{
this.OnIconUrlChanging(value);
this._IconUrl = value;
this.OnIconUrlChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _IconUrl;
partial void OnIconUrlChanging(string value);
partial void OnIconUrlChanged();
/// <summary>
/// There are no comments for Property ReportAbuseUrl in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string ReportAbuseUrl
{
get
{
return this._ReportAbuseUrl;
}
set
{
this.OnReportAbuseUrlChanging(value);
this._ReportAbuseUrl = value;
this.OnReportAbuseUrlChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _ReportAbuseUrl;
partial void OnReportAbuseUrlChanging(string value);
partial void OnReportAbuseUrlChanged();
/// <summary>
/// There are no comments for Property Categories in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Categories
{
get
{
return this._Categories;
}
set
{
this.OnCategoriesChanging(value);
this._Categories = value;
this.OnCategoriesChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Categories;
partial void OnCategoriesChanging(string value);
partial void OnCategoriesChanged();
/// <summary>
/// There are no comments for Property Tags in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Tags
{
get
{
return this._Tags;
}
set
{
this.OnTagsChanging(value);
this._Tags = value;
this.OnTagsChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Tags;
partial void OnTagsChanging(string value);
partial void OnTagsChanged();
/// <summary>
/// There are no comments for Property Dependencies in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Dependencies
{
get
{
return this._Dependencies;
}
set
{
this.OnDependenciesChanging(value);
this._Dependencies = value;
this.OnDependenciesChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Dependencies;
partial void OnDependenciesChanging(string value);
partial void OnDependenciesChanged();
/// <summary>
/// There are no comments for Screenshots in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public global::System.Collections.ObjectModel.Collection<PublishedScreenshot> Screenshots
{
get
{
return this._Screenshots;
}
set
{
if ((value != null))
{
this._Screenshots = value;
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private global::System.Collections.ObjectModel.Collection<PublishedScreenshot> _Screenshots = new global::System.Collections.ObjectModel.Collection<PublishedScreenshot>();
}
/// <summary>
/// There are no comments for Gallery.Infrastructure.FeedModels.PublishedScreenshot in the schema.
/// </summary>
/// <KeyProperties>
/// Id
/// </KeyProperties>
[global::System.Data.Services.Common.DataServiceKeyAttribute("Id")]
public partial class PublishedScreenshot
{
/// <summary>
/// Create a new PublishedScreenshot object.
/// </summary>
/// <param name="ID">Initial value of Id.</param>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public static PublishedScreenshot CreatePublishedScreenshot(int ID)
{
PublishedScreenshot publishedScreenshot = new PublishedScreenshot();
publishedScreenshot.Id = ID;
return publishedScreenshot;
}
/// <summary>
/// There are no comments for Property Id in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public int Id
{
get
{
return this._Id;
}
set
{
this.OnIdChanging(value);
this._Id = value;
this.OnIdChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private int _Id;
partial void OnIdChanging(int value);
partial void OnIdChanged();
/// <summary>
/// There are no comments for Property PublishedPackageId in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string PublishedPackageId
{
get
{
return this._PublishedPackageId;
}
set
{
this.OnPublishedPackageIdChanging(value);
this._PublishedPackageId = value;
this.OnPublishedPackageIdChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _PublishedPackageId;
partial void OnPublishedPackageIdChanging(string value);
partial void OnPublishedPackageIdChanged();
/// <summary>
/// There are no comments for Property PublishedPackageVersion in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string PublishedPackageVersion
{
get
{
return this._PublishedPackageVersion;
}
set
{
this.OnPublishedPackageVersionChanging(value);
this._PublishedPackageVersion = value;
this.OnPublishedPackageVersionChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _PublishedPackageVersion;
partial void OnPublishedPackageVersionChanging(string value);
partial void OnPublishedPackageVersionChanged();
/// <summary>
/// There are no comments for Property ScreenshotUri in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string ScreenshotUri
{
get
{
return this._ScreenshotUri;
}
set
{
this.OnScreenshotUriChanging(value);
this._ScreenshotUri = value;
this.OnScreenshotUriChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _ScreenshotUri;
partial void OnScreenshotUriChanging(string value);
partial void OnScreenshotUriChanged();
/// <summary>
/// There are no comments for Property Caption in the schema.
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
public string Caption
{
get
{
return this._Caption;
}
set
{
this.OnCaptionChanging(value);
this._Caption = value;
this.OnCaptionChanged();
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Services.Design", "1.0.0")]
private string _Caption;
partial void OnCaptionChanging(string value);
partial void OnCaptionChanged();
}
}

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="bf634e7d-1d71-45cd-b4d8-f06f74cb7bc7" xmlns="urn:schemas-microsoft-com:xml-dataservicemap">
<MetadataSources>
<MetadataSource Address="http://orchardproject.net:777/GalleryServer/FeedService.svc/" Protocol="http" SourceId="1" />
</MetadataSources>
<Metadata>
<MetadataFile FileName="service.edmx" MetadataType="Edmx" ID="ed52956e-0709-4cc7-a9ba-74cca2274614" SourceId="1" SourceUrl="http://orchardproject.net:777/GalleryServer/FeedService.svc/" />
</Metadata>
<Extensions />
</ReferenceGroup>

View File

@@ -0,0 +1,63 @@
<edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx">
<edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="1.0">
<Schema Namespace="Gallery.Infrastructure.FeedModels" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2006/04/edm">
<EntityType Name="PublishedPackage" m:HasStream="true">
<Key>
<PropertyRef Name="Id" />
<PropertyRef Name="Version" />
</Key>
<Property Name="Id" Type="Edm.String" Nullable="false" />
<Property Name="Version" Type="Edm.String" Nullable="false" />
<Property Name="Title" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationTitle" m:FC_ContentKind="text" m:FC_KeepInContent="true" />
<Property Name="Authors" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationAuthorName" m:FC_ContentKind="text" m:FC_KeepInContent="true" />
<Property Name="PackageType" Type="Edm.String" Nullable="true" />
<Property Name="Summary" Type="Edm.String" Nullable="true" m:FC_TargetPath="SyndicationSummary" m:FC_ContentKind="text" m:FC_KeepInContent="true" />
<Property Name="Description" Type="Edm.String" Nullable="true" />
<Property Name="DownloadCount" Type="Edm.Int32" Nullable="false" />
<Property Name="Copyright" Type="Edm.String" Nullable="true" />
<Property Name="PackageHashAlgorithm" Type="Edm.String" Nullable="true" />
<Property Name="PackageHash" Type="Edm.String" Nullable="true" />
<Property Name="PackageSize" Type="Edm.Int64" Nullable="false" />
<Property Name="Rating" Type="Edm.Double" Nullable="false" />
<Property Name="RatingCount" Type="Edm.Int32" Nullable="false" />
<Property Name="Price" Type="Edm.Decimal" Nullable="false" />
<Property Name="RequireLicenseAcceptance" Type="Edm.Boolean" Nullable="false" />
<Property Name="IsLatestVersion" Type="Edm.Boolean" Nullable="false" />
<Property Name="Created" Type="Edm.DateTime" Nullable="false" />
<Property Name="LastUpdated" Type="Edm.DateTime" Nullable="false" m:FC_TargetPath="SyndicationUpdated" m:FC_ContentKind="text" m:FC_KeepInContent="true" />
<Property Name="Published" Type="Edm.DateTime" Nullable="false" />
<Property Name="ExternalPackageUrl" Type="Edm.String" Nullable="true" />
<Property Name="ProjectUrl" Type="Edm.String" Nullable="true" />
<Property Name="LicenseUrl" Type="Edm.String" Nullable="true" />
<Property Name="IconUrl" Type="Edm.String" Nullable="true" />
<Property Name="ReportAbuseUrl" Type="Edm.String" Nullable="true" />
<NavigationProperty Name="Screenshots" Relationship="Gallery.Infrastructure.FeedModels.PublishedPackage_Screenshots" FromRole="PublishedPackage" ToRole="Screenshots" />
<Property Name="Categories" Type="Edm.String" Nullable="true" />
<Property Name="Tags" Type="Edm.String" Nullable="true" />
<Property Name="Dependencies" Type="Edm.String" Nullable="true" />
</EntityType>
<EntityType Name="PublishedScreenshot">
<Key>
<PropertyRef Name="Id" />
</Key>
<Property Name="Id" Type="Edm.Int32" Nullable="false" />
<Property Name="PublishedPackageId" Type="Edm.String" Nullable="true" />
<Property Name="PublishedPackageVersion" Type="Edm.String" Nullable="true" />
<Property Name="ScreenshotUri" Type="Edm.String" Nullable="true" />
<Property Name="Caption" Type="Edm.String" Nullable="true" />
</EntityType>
<Association Name="PublishedPackage_Screenshots">
<End Role="PublishedPackage" Type="Gallery.Infrastructure.FeedModels.PublishedPackage" Multiplicity="*" />
<End Role="Screenshots" Type="Gallery.Infrastructure.FeedModels.PublishedScreenshot" Multiplicity="*" />
</Association>
<EntityContainer Name="GalleryFeedContext" m:IsDefaultEntityContainer="true">
<EntitySet Name="Packages" EntityType="Gallery.Infrastructure.FeedModels.PublishedPackage" />
<EntitySet Name="Screenshots" EntityType="Gallery.Infrastructure.FeedModels.PublishedScreenshot" />
<AssociationSet Name="PublishedPackage_Screenshots" Association="Gallery.Infrastructure.FeedModels.PublishedPackage_Screenshots">
<End Role="PublishedPackage" EntitySet="Packages" />
<End Role="Screenshots" EntitySet="Screenshots" />
</AssociationSet>
</EntityContainer>
</Schema>
</edmx:DataServices>
</edmx:Edmx>

View File

@@ -94,7 +94,7 @@ namespace Orchard.Packaging.Services {
{
ExtensionName = package.Title ?? package.Id,
ExtensionVersion = package.Version.ToString(),
ExtensionType = package.Id.StartsWith(PackagingSourceManager.ThemesFilter) ? DefaultExtensionTypes.Theme : DefaultExtensionTypes.Module,
ExtensionType = package.Id.StartsWith(PackagingSourceManager.ThemesPrefix) ? DefaultExtensionTypes.Theme : DefaultExtensionTypes.Module,
ExtensionPath = applicationPath
};
}
@@ -129,9 +129,9 @@ namespace Orchard.Packaging.Services {
} else {
// otherwise delete the folder
string extensionPath = packageId.StartsWith(PackagingSourceManager.ThemesFilter)
? "~/Themes/" + packageId.Substring(PackagingSourceManager.ThemesFilter.Length)
: "~/Modules/" + packageId.Substring(PackagingSourceManager.ModulesFilter.Length);
string extensionPath = packageId.StartsWith(PackagingSourceManager.ThemesPrefix)
? "~/Themes/" + packageId.Substring(PackagingSourceManager.ThemesPrefix.Length)
: "~/Modules/" + packageId.Substring(PackagingSourceManager.ThemesPrefix.Length);
string extensionFullPath = HostingEnvironment.MapPath(extensionPath);

View File

@@ -4,14 +4,16 @@ using System.Linq;
using NuGet;
using Orchard.Data;
using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models;
using Orchard.Localization;
using Orchard.Packaging.GalleryServer;
using Orchard.Packaging.Models;
namespace Orchard.Packaging.Services {
[OrchardFeature("Gallery")]
public class PackagingSourceManager : IPackagingSourceManager {
public const string ModulesFilter = "Orchard.Module.";
public const string ThemesFilter = "Orchard.Theme.";
public const string ThemesPrefix = "Orchard.Themes.";
public const string ModulesPrefix = "Orchard.Modules.";
private readonly IRepository<PackagingSource> _packagingSourceRecordRepository;
@@ -41,32 +43,35 @@ namespace Orchard.Packaging.Services {
}
public IEnumerable<PackagingEntry> GetModuleList(PackagingSource packagingSource = null) {
return GetExtensionList(ModulesFilter, packagingSource);
return GetExtensionList(DefaultExtensionTypes.Module, packagingSource);
}
public IEnumerable<PackagingEntry> GetThemeList(PackagingSource packagingSource = null) {
return GetExtensionList(ThemesFilter, packagingSource);
return GetExtensionList(DefaultExtensionTypes.Theme, packagingSource);
}
private IEnumerable<PackagingEntry> GetExtensionList(string filter = null, PackagingSource packagingSource = null) {
return ( packagingSource == null ? GetSources() : new[] { packagingSource } )
return (packagingSource == null ? GetSources() : new[] {packagingSource})
.SelectMany(
source =>
new DataServicePackageRepository(new Uri(source.FeedUrl))
.GetPackages()
.Where(p => p.Id.StartsWith(filter ?? String.Empty))
new GalleryFeedContext(new Uri(source.FeedUrl)).Packages
.Where(p => p.PackageType == filter)
.ToList()
.Select(p => new PackagingEntry {
Title = String.IsNullOrWhiteSpace(p.Title) ? p.Id : p.Title,
PackageId = p.Id,
PackageStreamUri = p.ProjectUrl != null ? p.ProjectUrl.ToString() : String.Empty,
Source = source,
Version = p.Version != null ? p.Version.ToString() : String.Empty,
Description = p.Description,
Authors = p.Authors != null ? String.Join(", ", p.Authors) : String.Empty,
})
.Select(p => CreatePackageEntry(p, packagingSource))
).ToArray();
}
private static PackagingEntry CreatePackageEntry(PublishedPackage package, PackagingSource source) {
return new PackagingEntry {
Title = String.IsNullOrWhiteSpace(package.Title) ? package.Id : package.Title,
PackageId = package.Id,
PackageStreamUri = package.ProjectUrl != null ? package.ProjectUrl.ToString() : String.Empty,
Source = source,
Version = package.Version ?? String.Empty,
Description = package.Description,
Authors = package.Authors,
LastUpdated = package.LastUpdated
};
}
#endregion
}