Refactoring

--HG--
branch : dev
This commit is contained in:
Suha Can
2010-12-07 16:47:30 -08:00
parent 2b7b92c439
commit f6cfeb3d66
15 changed files with 42 additions and 46 deletions

View File

@@ -13,7 +13,6 @@ namespace Orchard.Core.Common.Drivers {
private readonly IAuthenticationService _authenticationService;
private readonly IAuthorizationService _authorizationService;
private readonly IMembershipService _membershipService;
private readonly IClock _clock;
public CommonPartDriver(
IOrchardServices services,
@@ -26,7 +25,6 @@ namespace Orchard.Core.Common.Drivers {
_authenticationService = authenticationService;
_authorizationService = authorizationService;
_membershipService = membershipService;
_clock = clock;
T = NullLocalizer.Instance;
Services = services;
}

View File

@@ -16,13 +16,11 @@ namespace Orchard.Core.Settings.Drivers {
private readonly ISiteService _siteService;
private readonly ICultureManager _cultureManager;
private readonly IMembershipService _membershipService;
private readonly INotifier _notifier;
public SiteSettingsPartDriver(ISiteService siteService, ICultureManager cultureManager, IMembershipService membershipService, INotifier notifier) {
_siteService = siteService;
_cultureManager = cultureManager;
_membershipService = membershipService;
_notifier = notifier;
T = NullLocalizer.Instance;
}

View File

@@ -49,7 +49,7 @@ namespace Lucene.Services {
}
public ISearchBuilder Parse(string defaultField, string query) {
return Parse(new string[] {defaultField}, query);
return Parse(new[] {defaultField}, query);
}
public ISearchBuilder Parse(string[] defaultFields, string query) {

View File

@@ -106,18 +106,20 @@ namespace Orchard.Blogs.Commands {
}
foreach ( var item in doc.Descendants("item") ) {
string postName = item.Element("title").Value;
if (item != null) {
string postName = item.Element("title").Value;
Context.Output.WriteLine("Adding post: {0}...", postName.Substring(0, Math.Min(postName.Length, 40)));
var post = _contentManager.New("BlogPost");
post.As<ICommonPart>().Owner = owner;
post.As<ICommonPart>().Container = blog;
var slug = Slugify(postName);
post.As<RoutePart>().Slug = slug;
post.As<RoutePart>().Path = post.As<RoutePart>().GetPathWithSlug(slug);
post.As<RoutePart>().Title = postName;
post.As<BodyPart>().Text = item.Element("description").Value;
_contentManager.Create(post);
Context.Output.WriteLine("Adding post: {0}...", postName.Substring(0, Math.Min(postName.Length, 40)));
var post = _contentManager.New("BlogPost");
post.As<ICommonPart>().Owner = owner;
post.As<ICommonPart>().Container = blog;
var slug = Slugify(postName);
post.As<RoutePart>().Slug = slug;
post.As<RoutePart>().Path = post.As<RoutePart>().GetPathWithSlug(slug);
post.As<RoutePart>().Title = postName;
post.As<BodyPart>().Text = item.Element("description").Value;
_contentManager.Create(post);
}
}

View File

@@ -170,7 +170,7 @@ namespace Orchard.ContentTypes.Controllers {
}
if (!ModelState.IsValid) {
Services.TransactionManager.Cancel(); ;
Services.TransactionManager.Cancel();
return AddPartsTo(id);
}

View File

@@ -17,7 +17,7 @@ namespace Orchard.Indexing.Settings {
}
private string _contentTypeName;
private bool _tasksCreated = false;
private bool _tasksCreated;
public override IEnumerable<TemplateViewModel> TypeEditor(ContentTypeDefinition definition) {
var model = definition.Settings.GetModel<TypeIndexing>();

View File

@@ -45,7 +45,7 @@ namespace Orchard.Packaging.Services {
public virtual FrameworkName TargetFramework {
get {
if (_targetFramework == null) {
_targetFramework = new FrameworkName(NetFrameworkIdentifier, typeof(string).Assembly.GetNameSafe().Version);;
_targetFramework = new FrameworkName(NetFrameworkIdentifier, typeof(string).Assembly.GetNameSafe().Version);
}
return _targetFramework;
}

View File

@@ -11,7 +11,6 @@ using System.Globalization;
namespace Orchard.PublishLater.Drivers {
public class PublishLaterPartDriver : ContentPartDriver<PublishLaterPart> {
private const string TemplateName = "Parts/PublishLater";
private readonly ICommonService _commonService;
private readonly IPublishLaterService _publishLaterService;
private const string DatePattern = "M/d/yyyy";
private const string TimePattern = "h:mm tt";
@@ -20,7 +19,6 @@ namespace Orchard.PublishLater.Drivers {
IOrchardServices services,
ICommonService commonService,
IPublishLaterService publishLaterService) {
_commonService = commonService;
_publishLaterService = publishLaterService;
T = NullLocalizer.Instance;
Services = services;

View File

@@ -93,7 +93,8 @@ namespace Orchard.Tags.Services {
var taggedContentItems = GetTaggedContentItems(tagRecord.Id);
foreach (var tagContentItem in tagsContentItems) {
if (!taggedContentItems.Any(c => c.ContentItem.Id == tagContentItem.TagsPartRecord.Id)) {
ContentTagRecord item = tagContentItem;
if (!taggedContentItems.Any(c => c.ContentItem.Id == item.TagsPartRecord.Id)) {
TagContentItem(tagContentItem.TagsPartRecord, tagName);
}
_contentTagRepository.Delete(tagContentItem);

View File

@@ -5,7 +5,6 @@ using Orchard.Users.Services;
namespace Orchard.Users.Commands {
public class UserCommands : DefaultOrchardCommandHandler {
private readonly IContentManager _contentManager;
private readonly IMembershipService _membershipService;
private readonly IUserService _userService;
@@ -13,7 +12,6 @@ namespace Orchard.Users.Commands {
IContentManager contentManager,
IMembershipService membershipService,
IUserService userService) {
_contentManager = contentManager;
_membershipService = membershipService;
_userService = userService;
}

View File

@@ -20,13 +20,11 @@ namespace Orchard.Users.Services {
private readonly IOrchardServices _orchardServices;
private readonly IMessageManager _messageManager;
private readonly IEnumerable<IUserEventHandler> _userEventHandlers;
private readonly IClock _clock;
public MembershipService(IOrchardServices orchardServices, IMessageManager messageManager, IEnumerable<IUserEventHandler> userEventHandlers, IClock clock) {
_orchardServices = orchardServices;
_messageManager = messageManager;
_userEventHandlers = userEventHandlers;
_clock = clock;
Logger = NullLogger.Instance;
T = NullLocalizer.Instance;
}

View File

@@ -23,7 +23,6 @@ namespace Orchard.Users.Services {
private readonly IMembershipService _membershipService;
private readonly IClock _clock;
private readonly IMessageManager _messageManager;
private readonly ShellSettings _shellSettings;
private readonly IEncryptionService _encryptionService;
public UserService(IContentManager contentManager, IMembershipService membershipService, IClock clock, IMessageManager messageManager, ShellSettings shellSettings, IEncryptionService encryptionService) {
@@ -31,7 +30,6 @@ namespace Orchard.Users.Services {
_membershipService = membershipService;
_clock = clock;
_messageManager = messageManager;
_shellSettings = shellSettings;
_encryptionService = encryptionService;
Logger = NullLogger.Instance;
}