Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# mgaerber 2/3/2006 11:49 AM
here is a proposal for the split up CR:

ICoreService:
using System;
using System.Collections;

namespace Cuyahoga.Core.Service
{
	/// Generic operations on persistent objects
	public interface ICoreService
	{
		object GetObjectById(Type type, int id);
		object GetObjectById(Type type, int id, bool allowNull);
		object GetObjectByDescription(Type type, string propertyName, string description);
		IList GetAll(Type type);
		IList GetAll(Type type, params string[] sortProperties);
		void SaveObject(object obj);
		void UpdateObject(object obj);
		void DeleteObject(object obj);
		void MarkForDeletion(object obj);

		//will following still be needed with NHibernate facility?
		void ClearCache(Type type);
		void ClearCollectionCache(string roleName);
		void ClearQueryCache(string cacheRegion);
	}
}

ISiteService:
using System;
using System.Collections;

using Cuyahoga.Core.Domain;

namespace Cuyahoga.Core.Service
{
	/// Common site operations
	public interface ISiteService
	{
		//site
		Site GetSiteBySiteUrl(string siteUrl);
		SiteAlias GetSiteAliasByUrl(string url);
		IList GetSiteAliasesBySite(Site site);
		//node
		IList GetRootNodes(Site site);
		Node GetRootNodeByCultureAndSite(string culture, Site site);
		Node GetNodeByShortDescriptionAndSite(string shortDescription, Site site);
		IList GetNodesByTemplate(Template template);
		void UpdateNode(Node node, bool propagatePermissionsToChildNodes, bool propagatePermissionsToSections);
		void DeleteNode(Node node);
		void PropagatePermissionsToChildNodes(Node parentNode, bool propagateToSections);
		void PropagatePermissionsToSections(Node node);
		//menu
		IList GetMenusByRootNode(Node rootNode);
		//section
		IList GetSortedSectionsByNode(Node node);
		IList GetUnconnectedSections();
		IList GetTemplatesBySection(Section section);
		//moduletype
		IList GetSectionsByModuleTypes(IList moduleTypes);
	}
}

IUserService:
using System;
using System.Collections;

using Cuyahoga.Core.Domain;

namespace Cuyahoga.Core.Service
{
	public interface IUserService
	{
		User GetUserByUsernameAndPassword(string username, string password);
		User GetUserByUsernameAndEmail(string username, string email);
		IList FindUsersByUsername(string searchString);
	}
}

IFileService:

TODO
# mgaerber 2/3/2006 11:53 AM (edited 2/3/2006 12:07 PM)
For usage with WindsorContainer the config would then look something like:

<components>

<component id="user.service"
service="Cuyahoga.Core.Service.IUserService, Cuyahoga.Core"
type="Cuyahoga.Core.Service.UserService, Cuyahoga.Core" />


Using the NHibernate facility, when a service has a non-empty constructor like:

public UserService(ISessionFactory sessionFactory) { ... }

The container will provide the SessionFactory automatically.

# martijnb 2/3/2006 3:16 PM
Wow, you're fast :).

I have to do a little analysis first about how much this will break existing code. But don't let that stop you. Could you create something like a proof of concept and put that on the wiki? We can then discuss from there.

Thanks!

# mgaerber 2/4/2006 2:36 AM
I will try to summarize this on the wiki this weekend.

I don't think it will be too hard and we could still let the CoreRepository be as it is right now for some time, only delegate calls from the existing "service" methods to the newly created services.

What would be really cool about using Windsor is that modules, or module controllers could be registered with the WindsorContainer as well, so you only have to put the services you need as parameters into the constructor and the Container tries to accomplish the rest.

What I didn't look at yet is, how newly installed modules would get their domain objects registered with the NHibernate facility, but that shouldn't be that different from now.