├── README.md ├── Rabbit.Web ├── Key.snk ├── IHasRequestContext.cs ├── Routes │ ├── IRoutePublisher.cs │ ├── IRouteProvider.cs │ └── IRoutePublisherEventHandler.cs ├── app.config ├── Environment │ └── IWebHost.cs ├── packages.config ├── IHttpContextAccessor.cs ├── UI │ └── Navigation │ │ ├── INavigationProvider.cs │ │ └── INavigationManager.cs ├── Themes │ ├── IThemeManager.cs │ ├── Impl │ │ ├── SafeModeThemeSelector.cs │ │ └── TenantThemeSelector.cs │ └── IThemeSelector.cs ├── Utility │ └── Extensions │ │ ├── ExtensionDescriptorExtensions.cs │ │ └── WorkContextExtensions.cs ├── Works │ ├── IWebWorkContextAccessor.cs │ └── WebWorkContextModule.cs ├── WebModule.cs ├── Properties │ └── AssemblyInfo.cs └── Impl │ └── HttpContextWorkContext.cs ├── Rabbit.Kernel ├── Key.snk ├── Bus │ ├── ILocalBus.cs │ ├── Impl │ │ └── DefaultBus.cs │ └── Exceptions │ │ └── RequestTimeoutException.cs ├── Localization │ ├── Localizer.cs │ ├── LocalizationUtilities.cs │ ├── IText.cs │ ├── Services │ │ ├── ILocalizedStringManager.cs │ │ ├── ICultureManager.cs │ │ └── ICultureSelector.cs │ └── NullLocalizer.cs ├── FileSystems │ ├── AppData │ │ └── IAppDataFolder.cs │ ├── Application │ │ ├── IApplicationFolder.cs │ │ └── Impl │ │ │ └── DefaultApplicationFolder.cs │ ├── VirtualPath │ │ ├── IVirtualPathProvider.cs │ │ ├── IVirtualPathMonitor.cs │ │ └── Impl │ │ │ └── DefaultVirtualPathProvider.cs │ └── Dependencies │ │ └── IDependenciesFolder.cs ├── packages.config ├── Events │ └── IEventHandler.cs ├── Caching │ ├── IVolatileProvider.cs │ ├── IVolatileToken.cs │ ├── ICacheContextAccessor.cs │ ├── IAsyncTokenProvider.cs │ ├── ICacheHolder.cs │ ├── ICache.cs │ ├── ISignals.cs │ ├── Impl │ │ ├── MemoryCachingBuilderExtensions.cs │ │ ├── DefaultCacheContextAccessor.cs │ │ └── DefaultCacheManager.cs │ └── Weak.cs ├── Environment │ ├── ShellBuilders │ │ ├── Models │ │ │ ├── DependencyBlueprintItem.cs │ │ │ └── BlueprintItem.cs │ │ ├── IShellContextFactory.cs │ │ ├── IMinimumShellDescriptorProvider.cs │ │ ├── IShellContainerRegistrations.cs │ │ ├── IShellContainerFactory.cs │ │ ├── ICompositionStrategy.cs │ │ ├── Impl │ │ │ ├── DefaultServiceTypeHarvester.cs │ │ │ └── KernelMinimumShellDescriptorProvider.cs │ │ └── ShellContext.cs │ ├── IShim.cs │ ├── IHostContainer.cs │ ├── IShell.cs │ ├── IShellEvents.cs │ ├── IHostLocalRestart.cs │ ├── Configuration │ │ ├── IShellSettingsManagerEventHandler.cs │ │ ├── TenantState.cs │ │ └── IShellSettingsManager.cs │ ├── Assemblies │ │ ├── IAssemblyNameResolver.cs │ │ └── Impl │ │ │ └── AppDomainAssemblyNameResolver.cs │ ├── Descriptor │ │ └── IShellDescriptorCache.cs │ ├── IHostEnvironment.cs │ ├── IHost.cs │ └── IBuildManager.cs ├── Tasks │ ├── IBackgroundTask.cs │ ├── IBackgroundService.cs │ ├── ISweepGenerator.cs │ └── IBackgroundServiceEvents.cs ├── Extensions │ ├── IExtensionLoaderCoordinator.cs │ ├── IExtensionMonitoringCoordinator.cs │ ├── Models │ │ ├── DependencyDescriptor.cs │ │ └── Feature.cs │ ├── Folders │ │ ├── IExtensionFolders.cs │ │ ├── IExtensionHarvester.cs │ │ └── Impl │ │ │ └── ModuleFolders.cs │ ├── SuppressDependencyAttribute.cs │ ├── ExtensionEntry.cs │ ├── FeatureAttribute.cs │ └── IFeatureDescriptorFilter.cs ├── Works │ ├── WorkContextProperty.cs │ ├── IWorkContextEvents.cs │ ├── IWorkContextStateProvider.cs │ ├── IWorkContextAccessor.cs │ ├── IWorkContextScope.cs │ └── Work.cs ├── Settings │ ├── ITenantService.cs │ ├── ITenant.cs │ └── Impl │ │ ├── DefaultTenantService.cs │ │ └── CurrentTenantWorkContext.cs ├── WorkContextExtensions.cs ├── app.config ├── Exceptions │ └── ExceptionExtensions.cs ├── Properties │ └── AssemblyInfo.cs ├── Services │ └── IClock.cs └── CollectionOrderModule.cs ├── Tests └── Rabbit.Kernel.Tests │ ├── App_Data │ └── Tenants │ │ ├── Tenant1 │ │ └── Settings.txt │ │ └── Tenant2 │ │ └── Settings.txt │ ├── Modules │ ├── Rabbit.Test │ │ ├── bin │ │ │ └── Rabbit.Test.dll │ │ └── Module.txt │ └── Rabbit.Test2 │ │ └── Module.txt │ ├── packages.config │ ├── App.config │ ├── Extensions │ └── ExtensionHarvesterTests.cs │ ├── Config │ └── Logging │ │ └── LoggingConfig.config │ ├── Environment │ ├── HostEnvironmentTests.cs │ └── BuildManagerTests.cs │ ├── Properties │ └── AssemblyInfo.cs │ └── Caching │ └── CacheManagerTests.cs ├── Rabbit.Web.Mvc ├── Key.snk ├── WebApi │ ├── AutofacWebApiDependencyScope.cs │ ├── DefaultWebApiHttpControllerSelector.cs │ ├── DefaultWebApiHttpHttpControllerActivator.cs │ └── Routes │ │ └── IHttpRouteProvider.cs ├── UI │ ├── Admin │ │ ├── AdminAttribute.cs │ │ └── AdminThemeSelector.cs │ └── Zones │ │ └── LayoutWorkContext.cs ├── Mvc │ ├── Filters │ │ ├── IFilterProvider.cs │ │ └── RabbitFilterProvider.cs │ ├── ViewEngines │ │ ├── ThemeAwareness │ │ │ ├── ILayoutAwareViewEngine.cs │ │ │ ├── IConfiguredEnginesCache.cs │ │ │ └── IThemeAwareViewEngine.cs │ │ └── Razor │ │ │ └── IRazorCompilationEvents.cs │ ├── ModelBinders │ │ ├── IModelBinderProvider.cs │ │ ├── IModelBinderPublisher.cs │ │ ├── ModelBinderDescriptor.cs │ │ └── Impl │ │ │ └── DefaultModelBinderPublisher.cs │ └── Html │ │ └── HtmlHelperExtensions.cs ├── Environment │ └── ShellBuilders │ │ └── Models │ │ └── ControllerBlueprint.cs ├── DisplayManagement │ ├── IShape.cs │ ├── Implementation │ │ ├── IDisplayManager.cs │ │ ├── DisplayContext.cs │ │ └── DisplayHelperFactory.cs │ ├── INamedEnumerable.cs │ ├── Descriptors │ │ ├── ShapeTable.cs │ │ ├── ShapePlacementStrategy │ │ │ └── PlacementFile.cs │ │ ├── ShapeTableLocator.cs │ │ ├── ShapeAttributeStrategy │ │ │ └── ShapeAttributeOccurrence.cs │ │ └── Interfaces.cs │ ├── IDisplayHelperFactory.cs │ ├── ShapeAttribute.cs │ ├── IShapeDisplay.cs │ ├── Shapes │ │ └── Impl │ │ │ └── DefaultTagBuilderFactory.cs │ └── IShapeFactory.cs ├── app.config ├── Themes │ └── ThemedAttribute.cs ├── Works │ └── MvcWorkContext.cs ├── Properties │ └── AssemblyInfo.cs ├── Utility │ └── Extensions │ │ ├── WorkContextExtensions.cs │ │ └── DefaultExtensionTypes.cs └── packages.config ├── Rabbit.Web.WarmupStarter ├── Key.snk └── Properties │ └── AssemblyInfo.cs └── Components ├── Rabbit.Components.Data ├── Key.snk ├── packages.config ├── IEntity.cs ├── EntityAttribute.cs ├── DataAnnotations │ ├── ComplexTypeAttribute.cs │ ├── NotMappedAttribute.cs │ ├── ForeignKeyAttribute.cs │ └── InversePropertyAttribute.cs ├── IRepositoryInitializer.cs ├── Models │ └── RecordBlueprint.cs ├── Providers │ ├── IDataServicesProvider.cs │ └── SqlServerDataServicesProvider.cs ├── ITransactionManager.cs ├── Properties │ └── AssemblyInfo.cs └── Utility │ └── Extensions │ └── ShellBlueprintExtensions.cs ├── Rabbit.Components.Command ├── Key.snk ├── CommandAttribute.cs ├── packages.config ├── CommandAction.cs └── Properties │ └── AssemblyInfo.cs ├── Rabbit.Components.Data.Mvc ├── Key.snk ├── packages.config ├── DataBuilderExtensions.cs ├── TransactionFilter.cs └── Properties │ └── AssemblyInfo.cs ├── Rabbit.Components.DataBase ├── Key.snk ├── packages.config ├── Providers │ └── IDbConnectionProvider.cs ├── BuilderExtensions.cs └── Properties │ └── AssemblyInfo.cs ├── Rabbit.Components.Security ├── Key.snk ├── packages.config ├── IUserRoles.cs ├── IUser.cs ├── Permissions │ ├── PermissionStereotype.cs │ ├── IPermissionProvider.cs │ └── Permission.cs ├── CheckAccessContext.cs ├── IAuthorizationServiceEventHandler.cs ├── IAuthenticationService.cs ├── WorkContentExtensions.cs ├── Properties │ └── AssemblyInfo.cs ├── IAuthorizationService.cs └── CurrentUserWorkContext.cs ├── Rabbit.Components.Bus.SignalR ├── Key.snk ├── packages.config ├── Properties │ └── AssemblyInfo.cs └── BusBuilderExtensions.cs ├── Rabbit.Components.Web.SignalR ├── Key.snk ├── IRabbitHubConfiguration.cs ├── NullAssemblyLocator.cs ├── BuilderExtensions.cs ├── packages.config ├── RabbitHubConfiguration.cs ├── Properties │ └── AssemblyInfo.cs └── ConnectionAttribute.cs ├── Rabbit.Components.Data.Migrators ├── Key.snk ├── packages.config ├── VersionTable.cs ├── Providers │ └── IMigratorDataServicesProvider.cs └── Properties │ └── AssemblyInfo.cs ├── Rabbit.Components.DataBase.MySql ├── Key.snk ├── packages.config ├── app.config └── Properties │ └── AssemblyInfo.cs ├── Rabbit.Components.Logging.NLog ├── Key.snk ├── ILoggerFactory.cs ├── packages.config ├── MinimumShellDescriptorProvider.cs ├── LogUtilities.cs ├── LoggerFactory.cs ├── LoggingBuilderExtensions.cs └── Properties │ └── AssemblyInfo.cs ├── Rabbit.Components.Security.Web ├── Key.snk ├── AlwaysAccessibleAttribute.cs ├── IRoleService.cs ├── packages.config ├── WebSecurityBuilderExtensions.cs ├── Properties │ └── AssemblyInfo.cs └── NavigationItemBuilderExtensions.cs ├── Rabbit.Components.Logging.NLog.Web ├── Key.snk ├── packages.config ├── Properties │ └── AssemblyInfo.cs └── UrlLayoutRenderer.cs ├── Rabbit.Components.Data.EntityFramework ├── Key.snk ├── packages.config ├── IDbContextFactory.cs ├── DefaultDbContext.cs ├── Providers │ ├── IEntityFrameworkDataServicesProvider.cs │ └── SqlServerEntityFrameworkDataServicesProvider.cs ├── GlobalConfig.cs ├── Conventions │ ├── NotMappedTypeAttributeConvention.cs │ ├── ComplexTypeAttributeConvention.cs │ ├── InversePropertyAttributeConvention.cs │ ├── ForeignKeyPrimitivePropertyAttributeConvention.cs │ └── NotMappedPropertyAttributeConvention.cs ├── App.config ├── Properties │ └── AssemblyInfo.cs ├── Impl │ └── DefaultDbConfiguration.cs └── Migrations │ └── Configuration.cs ├── Rabbit.Components.Data.MySql ├── packages.config ├── app.config ├── DataBuilderExtensions.cs ├── MySqlDataServicesProvider.cs └── Properties │ └── AssemblyInfo.cs ├── Rabbit.Components.Data.Migrators.MySql ├── packages.config ├── DataBuilderExtensions.cs └── Properties │ └── AssemblyInfo.cs └── Rabbit.Components.Data.EntityFramework.MySql ├── packages.config ├── DataBuilderExtensions.cs ├── MySqlEntityFrameworkDataServicesProvider.cs └── Properties └── AssemblyInfo.cs /README.md: -------------------------------------------------------------------------------- 1 | # RabbitHub 2 | RabbitHub(兔窝) 3 | -------------------------------------------------------------------------------- /Rabbit.Web/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Rabbit.Web/Key.snk -------------------------------------------------------------------------------- /Rabbit.Kernel/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Rabbit.Kernel/Key.snk -------------------------------------------------------------------------------- /Tests/Rabbit.Kernel.Tests/App_Data/Tenants/Tenant1/Settings.txt: -------------------------------------------------------------------------------- 1 | Name: Tenant1 2 | State: Running -------------------------------------------------------------------------------- /Tests/Rabbit.Kernel.Tests/App_Data/Tenants/Tenant2/Settings.txt: -------------------------------------------------------------------------------- 1 | Name: Tenant2 2 | State: Running -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Rabbit.Web.Mvc/Key.snk -------------------------------------------------------------------------------- /Rabbit.Kernel/Bus/ILocalBus.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Rabbit.Kernel/Bus/ILocalBus.cs -------------------------------------------------------------------------------- /Rabbit.Web.WarmupStarter/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Rabbit.Web.WarmupStarter/Key.snk -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Components/Rabbit.Components.Data/Key.snk -------------------------------------------------------------------------------- /Rabbit.Kernel/Localization/Localizer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Rabbit.Kernel/Localization/Localizer.cs -------------------------------------------------------------------------------- /Components/Rabbit.Components.Command/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Components/Rabbit.Components.Command/Key.snk -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.Mvc/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Components/Rabbit.Components.Data.Mvc/Key.snk -------------------------------------------------------------------------------- /Components/Rabbit.Components.DataBase/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Components/Rabbit.Components.DataBase/Key.snk -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Components/Rabbit.Components.Security/Key.snk -------------------------------------------------------------------------------- /Components/Rabbit.Components.Bus.SignalR/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Components/Rabbit.Components.Bus.SignalR/Key.snk -------------------------------------------------------------------------------- /Components/Rabbit.Components.Web.SignalR/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Components/Rabbit.Components.Web.SignalR/Key.snk -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.Migrators/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Components/Rabbit.Components.Data.Migrators/Key.snk -------------------------------------------------------------------------------- /Components/Rabbit.Components.DataBase.MySql/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Components/Rabbit.Components.DataBase.MySql/Key.snk -------------------------------------------------------------------------------- /Components/Rabbit.Components.Logging.NLog/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Components/Rabbit.Components.Logging.NLog/Key.snk -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security.Web/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Components/Rabbit.Components.Security.Web/Key.snk -------------------------------------------------------------------------------- /Rabbit.Kernel/FileSystems/AppData/IAppDataFolder.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Rabbit.Kernel/FileSystems/AppData/IAppDataFolder.cs -------------------------------------------------------------------------------- /Components/Rabbit.Components.Logging.NLog.Web/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Components/Rabbit.Components.Logging.NLog.Web/Key.snk -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/WebApi/AutofacWebApiDependencyScope.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Rabbit.Web.Mvc/WebApi/AutofacWebApiDependencyScope.cs -------------------------------------------------------------------------------- /Components/Rabbit.Components.Command/CommandAttribute.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Components/Rabbit.Components.Command/CommandAttribute.cs -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/Key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Components/Rabbit.Components.Data.EntityFramework/Key.snk -------------------------------------------------------------------------------- /Rabbit.Kernel/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Components/Rabbit.Components.Logging.NLog/ILoggerFactory.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Components/Rabbit.Components.Logging.NLog/ILoggerFactory.cs -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/WebApi/DefaultWebApiHttpControllerSelector.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Rabbit.Web.Mvc/WebApi/DefaultWebApiHttpControllerSelector.cs -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/WebApi/DefaultWebApiHttpHttpControllerActivator.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Rabbit.Web.Mvc/WebApi/DefaultWebApiHttpHttpControllerActivator.cs -------------------------------------------------------------------------------- /Tests/Rabbit.Kernel.Tests/Modules/Rabbit.Test/bin/Rabbit.Test.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RabbitTeam/RabbitHub/HEAD/Tests/Rabbit.Kernel.Tests/Modules/Rabbit.Test/bin/Rabbit.Test.dll -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Components/Rabbit.Components.DataBase/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.MySql/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Components/Rabbit.Components.Logging.NLog.Web/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Components/Rabbit.Components.DataBase.MySql/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Rabbit.Kernel/Events/IEventHandler.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Events 2 | { 3 | /// 4 | /// 一个抽象的事件处理程序。 5 | /// 6 | public interface IEventHandler : IDependency 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Caching/IVolatileProvider.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Caching 2 | { 3 | /// 4 | /// 一个抽象的挥发提供程序。 5 | /// 6 | public interface IVolatileProvider : ISingletonDependency 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /Tests/Rabbit.Kernel.Tests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/UI/Admin/AdminAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Web.Mvc.UI.Admin 4 | { 5 | /// 6 | /// 管理标记。 7 | /// 8 | public sealed class AdminAttribute : Attribute 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/FileSystems/Application/IApplicationFolder.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.FileSystems.Application 2 | { 3 | /// 4 | /// 一个抽象的应用程序文件夹。 5 | /// 6 | public interface IApplicationFolder : IFolder 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Logging.NLog/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Components/Rabbit.Components.Command/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Mvc/Filters/IFilterProvider.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | 3 | namespace Rabbit.Web.Mvc.Mvc.Filters 4 | { 5 | /// 6 | /// 一个抽象的筛选器提供程序。 7 | /// 8 | public interface IFilterProvider : IDependency 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/ShellBuilders/Models/DependencyBlueprintItem.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Environment.ShellBuilders.Models 2 | { 3 | /// 4 | /// 依赖项蓝图。 5 | /// 6 | public sealed class DependencyBlueprintItem : BlueprintItem 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Mvc/ViewEngines/ThemeAwareness/ILayoutAwareViewEngine.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Web.Mvc; 3 | 4 | namespace Rabbit.Web.Mvc.Mvc.ViewEngines.ThemeAwareness 5 | { 6 | internal interface ILayoutAwareViewEngine : IDependency, IViewEngine 7 | { 8 | } 9 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.Migrators.MySql/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /Tests/Rabbit.Kernel.Tests/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Rabbit.Kernel/Bus/Impl/DefaultBus.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Bus.Impl 2 | { 3 | internal sealed class DefaultBus : Bus, ILocalBus 4 | { 5 | public DefaultBus(IMessageDispatcher messageDispatcher) 6 | : base(messageDispatcher) 7 | { 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/IDbContextFactory.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Data.Entity; 3 | 4 | namespace Rabbit.Components.Data.EntityFramework 5 | { 6 | internal interface IDbContextFactory : IDependency 7 | { 8 | DbContext CreateDbContext(); 9 | } 10 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data/IEntity.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Components.Data 2 | { 3 | /// 4 | /// 表示一个抽象的带有键的实体。 5 | /// 6 | public interface IEntity 7 | { 8 | /// 9 | /// 键值。 10 | /// 11 | long Id { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Tasks/IBackgroundTask.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Tasks 2 | { 3 | /// 4 | /// 一个抽象的后台任务。 5 | /// 6 | public interface IBackgroundTask : IDependency 7 | { 8 | /// 9 | /// 扫描。 10 | /// 11 | void Sweep(); 12 | } 13 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Web.SignalR/IRabbitHubConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNet.SignalR; 2 | using Rabbit.Kernel; 3 | 4 | namespace Rabbit.Components.Web.SignalR 5 | { 6 | internal interface IRabbitHubConfiguration : IDependency 7 | { 8 | HubConfiguration ConnectionConfiguration { get; } 9 | } 10 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/IShim.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Environment 2 | { 3 | /// 4 | /// 一个抽象的垫片。 5 | /// 6 | public interface IShim 7 | { 8 | /// 9 | /// 主机容器。 10 | /// 11 | IHostContainer HostContainer { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Tasks/IBackgroundService.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Tasks 2 | { 3 | /// 4 | /// 一个抽象的后台服务。 5 | /// 6 | public interface IBackgroundService : IDependency 7 | { 8 | /// 9 | /// 扫描。 10 | /// 11 | void Sweep(); 12 | } 13 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/FileSystems/VirtualPath/IVirtualPathProvider.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Caching; 2 | 3 | namespace Rabbit.Kernel.FileSystems.VirtualPath 4 | { 5 | /// 6 | /// 一个抽象的虚拟路径提供者。 7 | /// 8 | public interface IVirtualPathProvider : IVirtualPathProviderBase, IVolatileProvider 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Caching/IVolatileToken.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Caching 2 | { 3 | /// 4 | /// 一个抽象的挥发令牌。 5 | /// 6 | public interface IVolatileToken 7 | { 8 | /// 9 | /// 标识缓存是否有效,true为有效,false为失效。 10 | /// 11 | bool IsCurrent { get; } 12 | } 13 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.Migrators/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data/EntityAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Components.Data 4 | { 5 | /// 6 | /// 表示类型是一个实体。 7 | /// 8 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 9 | public sealed class EntityAttribute : Attribute 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Bus.SignalR/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Rabbit.Kernel/Caching/ICacheContextAccessor.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Caching 2 | { 3 | /// 4 | /// 一个抽象的缓存上下文访问器。 5 | /// 6 | public interface ICacheContextAccessor 7 | { 8 | /// 9 | /// 当前获取上下文。 10 | /// 11 | IAcquireContext Current { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Extensions/IExtensionLoaderCoordinator.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Extensions 2 | { 3 | /// 4 | /// 一个抽象的扩展装载机协调员。 5 | /// 6 | public interface IExtensionLoaderCoordinator 7 | { 8 | /// 9 | /// 安装扩展。 10 | /// 11 | void SetupExtensions(); 12 | } 13 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework.MySql/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Rabbit.Web/IHasRequestContext.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Routing; 2 | 3 | namespace Rabbit.Web 4 | { 5 | /// 6 | /// 表示含有一个请求上下文的抽象接口。 7 | /// 8 | public interface IHasRequestContext 9 | { 10 | /// 11 | /// 请求上下文。 12 | /// 13 | RequestContext RequestContext { get; } 14 | } 15 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data/DataAnnotations/ComplexTypeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Components.Data.DataAnnotations 4 | { 5 | /// 6 | /// 复杂类型标记。 7 | /// 8 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] 9 | public sealed class ComplexTypeAttribute : Attribute 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security/IUserRoles.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Rabbit.Components.Security 4 | { 5 | /// 6 | /// 一个抽象的用户角色接口。 7 | /// 8 | public interface IUserRoles 9 | { 10 | /// 11 | /// 用户所有角色。 12 | /// 13 | IList Roles { get; } 14 | } 15 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Works/WorkContextProperty.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Works 2 | { 3 | /// 4 | /// 工作上下文属性。 5 | /// 6 | /// 属性类型。 7 | public sealed class WorkContextProperty 8 | { 9 | /// 10 | /// 属性值。 11 | /// 12 | public T Value { get; set; } 13 | } 14 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data/IRepositoryInitializer.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | 3 | namespace Rabbit.Components.Data 4 | { 5 | /// 6 | /// 一个抽象的数据库初始化器。 7 | /// 8 | public interface IRepositoryInitializer : IDependency 9 | { 10 | /// 11 | /// 初始化动作。 12 | /// 13 | void Initialize(); 14 | } 15 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Settings/ITenantService.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Settings 2 | { 3 | /// 4 | /// 一个抽象的租户服务。 5 | /// 6 | public interface ITenantService : IDependency 7 | { 8 | /// 9 | /// 获取当前租户设置。 10 | /// 11 | /// 当前租户设置实例。 12 | ITenant GetTenantSettings(); 13 | } 14 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Environment/ShellBuilders/Models/ControllerBlueprint.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Environment.ShellBuilders.Models; 2 | 3 | namespace Rabbit.Web.Mvc.Environment.ShellBuilders.Models 4 | { 5 | internal sealed class ControllerBlueprint : BlueprintItem 6 | { 7 | public string AreaName { get; set; } 8 | 9 | public string ControllerName { get; set; } 10 | } 11 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data/DataAnnotations/NotMappedAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Components.Data.DataAnnotations 4 | { 5 | /// 6 | /// 不进行映射。 7 | /// 8 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, AllowMultiple = false)] 9 | public sealed class NotMappedAttribute : Attribute 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/DisplayManagement/IShape.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Web.Mvc.DisplayManagement.Shapes; 2 | 3 | namespace Rabbit.Web.Mvc.DisplayManagement 4 | { 5 | /// 6 | /// 一个抽象的形状。 7 | /// 8 | public interface IShape 9 | { 10 | /// 11 | /// 形状元数据。 12 | /// 13 | ShapeMetadata Metadata { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/IHostContainer.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Environment 2 | { 3 | /// 4 | /// 一个抽象的主机容器。 5 | /// 6 | public interface IHostContainer 7 | { 8 | /// 9 | /// 解析服务。 10 | /// 11 | /// 服务类型。 12 | /// 服务实例。 13 | T Resolve(); 14 | } 15 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/IShell.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Environment 2 | { 3 | /// 4 | /// 一个抽象的外壳接口。 5 | /// 6 | public interface IShell 7 | { 8 | /// 9 | /// 激活外壳。 10 | /// 11 | void Activate(); 12 | 13 | /// 14 | /// 终止外壳。 15 | /// 16 | void Terminate(); 17 | } 18 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security.Web/AlwaysAccessibleAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Components.Security.Web 4 | { 5 | /// 6 | /// 适用于控制器或动作,将阻止任何行动被过滤的 网站前端访问 许可。 7 | /// 8 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)] 9 | public class AlwaysAccessibleAttribute : Attribute 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Localization/LocalizationUtilities.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | 3 | namespace Rabbit.Kernel.Localization 4 | { 5 | internal sealed class LocalizationUtilities 6 | { 7 | public static Localizer Resolve(IComponentContext context, string scope) 8 | { 9 | var text = context.Resolve(new NamedParameter("scope", scope)); 10 | return text.Get; 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data/Models/RecordBlueprint.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Environment.ShellBuilders.Models; 2 | 3 | namespace Rabbit.Components.Data.Models 4 | { 5 | /// 6 | /// 记录蓝图项。 7 | /// 8 | public sealed class RecordBlueprint : BlueprintItem 9 | { 10 | /// 11 | /// 表名称。 12 | /// 13 | public string TableName { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /Tests/Rabbit.Kernel.Tests/Modules/Rabbit.Test2/Module.txt: -------------------------------------------------------------------------------- 1 | Name: Test2 2 | Category: Default 3 | Description: 测试模块2 4 | FeatureDescription: 5 | Version: 1.0.0.0 6 | KernelVersion: 1.0.0.0 7 | Runtime: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089|System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 8 | WebSite: 9 | Company: 10 | Author: majian 11 | Tags: 12 | Dependencies: 13 | Features: -------------------------------------------------------------------------------- /Rabbit.Kernel/Tasks/ISweepGenerator.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Tasks 2 | { 3 | /// 4 | /// 一个抽象的扫描发生器。 5 | /// 6 | public interface ISweepGenerator : ISingletonDependency 7 | { 8 | /// 9 | /// 激活。 10 | /// 11 | void Activate(); 12 | 13 | /// 14 | /// 终止。 15 | /// 16 | void Terminate(); 17 | } 18 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security/IUser.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Components.Security 2 | { 3 | /// 4 | /// 一个抽象的用户。 5 | /// 6 | public interface IUser 7 | { 8 | /// 9 | /// 用户标识。 10 | /// 11 | string Identity { get; set; } 12 | 13 | /// 14 | /// 用户名称。 15 | /// 16 | string UserName { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Mvc/ViewEngines/Razor/IRazorCompilationEvents.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Razor.Generator; 2 | using System.Web.WebPages.Razor; 3 | 4 | namespace Rabbit.Web.Mvc.Mvc.ViewEngines.Razor 5 | { 6 | internal interface IRazorCompilationEvents 7 | { 8 | void CodeGenerationStarted(RazorBuildProvider provider); 9 | 10 | void CodeGenerationCompleted(RazorBuildProvider provider, CodeGenerationCompleteEventArgs e); 11 | } 12 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/IShellEvents.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Environment 2 | { 3 | /// 4 | /// 一个抽象的外壳事件。 5 | /// 6 | public interface IShellEvents : IDependency 7 | { 8 | /// 9 | /// 激活外壳完成后执行。 10 | /// 11 | void Activated(); 12 | 13 | /// 14 | /// 终止外壳前候执行。 15 | /// 16 | void Terminating(); 17 | } 18 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/IHostLocalRestart.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Caching; 2 | using System; 3 | 4 | namespace Rabbit.Kernel.Environment 5 | { 6 | /// 7 | /// 一个抽象的本地主机重启器。 8 | /// 9 | public interface IHostLocalRestart 10 | { 11 | /// 12 | /// 监控动作。 13 | /// 14 | /// 监控动作。 15 | void Monitor(Action monitor); 16 | } 17 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Works/IWorkContextEvents.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Works 2 | { 3 | /// 4 | /// 一个抽象的工作上下文事件。 5 | /// 6 | public interface IWorkContextEvents : IUnitOfWorkDependency 7 | { 8 | /// 9 | /// 工作上下文启动之后执行。 10 | /// 11 | void Started(); 12 | 13 | /// 14 | /// 工作上下文完成之后执行。 15 | /// 16 | void Finished(); 17 | } 18 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/DefaultDbContext.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity; 2 | using System.Data.Entity.Infrastructure; 3 | 4 | namespace Rabbit.Components.Data.EntityFramework 5 | { 6 | internal sealed class DefaultDbContext : DbContext 7 | { 8 | public DefaultDbContext(string nameOrConnectionString, DbCompiledModel dbCompiledModel) 9 | : base(nameOrConnectionString, dbCompiledModel) 10 | { 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Rabbit.Web/Routes/IRoutePublisher.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Collections.Generic; 3 | 4 | namespace Rabbit.Web.Routes 5 | { 6 | /// 7 | /// 一个抽象的路由发布者。 8 | /// 9 | public interface IRoutePublisher : IDependency 10 | { 11 | /// 12 | /// 发布路由。 13 | /// 14 | /// 路由集合。 15 | void Publish(IEnumerable routes); 16 | } 17 | } -------------------------------------------------------------------------------- /Rabbit.Web/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Rabbit.Web/Environment/IWebHost.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Environment; 2 | 3 | namespace Rabbit.Web.Environment 4 | { 5 | /// 6 | /// 一个抽象的Web主机。 7 | /// 8 | public interface IWebHost : IHost 9 | { 10 | /// 11 | /// 请求开始时执行。 12 | /// 13 | void BeginRequest(); 14 | 15 | /// 16 | /// 请求结束时候执行。 17 | /// 18 | void EndRequest(); 19 | } 20 | } -------------------------------------------------------------------------------- /Rabbit.Web/Routes/IRouteProvider.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Collections.Generic; 3 | 4 | namespace Rabbit.Web.Routes 5 | { 6 | /// 7 | /// 一个抽象的路由提供程序。 8 | /// 9 | public interface IRouteProvider : IDependency 10 | { 11 | /// 12 | /// 获取路由信息。 13 | /// 14 | /// 路由集合。 15 | void GetRoutes(ICollection routes); 16 | } 17 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Caching/IAsyncTokenProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Kernel.Caching 4 | { 5 | /// 6 | /// 一个抽象的异步象征提供程序。 7 | /// 8 | public interface IAsyncTokenProvider 9 | { 10 | /// 11 | /// 获取象征。 12 | /// 13 | /// 任务。 14 | /// 挥发象征。 15 | IVolatileToken GetToken(Action> task); 16 | } 17 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Localization/IText.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Localization 2 | { 3 | /// 4 | /// 一个抽象的文本。 5 | /// 6 | public interface IText 7 | { 8 | /// 9 | /// 获取本地化字符串。 10 | /// 11 | /// 文本示意。 12 | /// 参数。 13 | /// 本地化字符串。 14 | LocalizedString Get(string textHint, params object[] args); 15 | } 16 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Extensions/IExtensionMonitoringCoordinator.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Caching; 2 | using System; 3 | 4 | namespace Rabbit.Kernel.Extensions 5 | { 6 | /// 7 | /// 一个抽象的扩展监控协调者。 8 | /// 9 | public interface IExtensionMonitoringCoordinator 10 | { 11 | /// 12 | /// 监控扩展。 13 | /// 14 | /// 监控动作。 15 | void MonitorExtensions(Action monitor); 16 | } 17 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Extensions/Models/DependencyDescriptor.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Extensions.Models 2 | { 3 | /// 4 | /// 依赖描述符。 5 | /// 6 | public sealed class DependencyDescriptor 7 | { 8 | /// 9 | /// 扩展Id。 10 | /// 11 | public string ExtensionId { get; set; } 12 | 13 | /// 14 | /// 扩展版本范围。 15 | /// 16 | public VersionRange Version { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Mvc/ModelBinders/IModelBinderProvider.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Collections.Generic; 3 | 4 | namespace Rabbit.Web.Mvc.Mvc.ModelBinders 5 | { 6 | /// 7 | /// 一个抽象的模型绑定提供程序。 8 | /// 9 | public interface IModelBinderProvider : IDependency 10 | { 11 | /// 12 | /// 获取模型绑定程序。 13 | /// 14 | /// 绑定程序集合。 15 | IEnumerable GetModelBinders(); 16 | } 17 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Extensions/Folders/IExtensionFolders.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Extensions.Models; 2 | using System.Collections.Generic; 3 | 4 | namespace Rabbit.Kernel.Extensions.Folders 5 | { 6 | /// 7 | /// 一个抽象的扩展文件夹。 8 | /// 9 | public interface IExtensionFolders 10 | { 11 | /// 12 | /// 可用的扩展。 13 | /// 14 | /// 扩展描述条目符集合。 15 | IEnumerable AvailableExtensions(); 16 | } 17 | } -------------------------------------------------------------------------------- /Rabbit.Web/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Mvc/ModelBinders/IModelBinderPublisher.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Collections.Generic; 3 | 4 | namespace Rabbit.Web.Mvc.Mvc.ModelBinders 5 | { 6 | /// 7 | /// 一个抽象的模型绑定程序发布者。 8 | /// 9 | public interface IModelBinderPublisher : IDependency 10 | { 11 | /// 12 | /// 发布。 13 | /// 14 | /// 绑定信息。 15 | void Publish(IEnumerable binders); 16 | } 17 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/Configuration/IShellSettingsManagerEventHandler.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Events; 2 | 3 | namespace Rabbit.Kernel.Environment.Configuration 4 | { 5 | /// 6 | /// 一个抽象的外壳设置管理者事件处理程序。 7 | /// 8 | public interface IShellSettingsManagerEventHandler : IEventHandler 9 | { 10 | /// 11 | /// 外壳设置保存成功之后。 12 | /// 13 | /// 外壳设置信息。 14 | void Saved(ShellSettings settings); 15 | } 16 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.DataBase.MySql/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/WebApi/Routes/IHttpRouteProvider.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using Rabbit.Web.Routes; 3 | using System.Collections.Generic; 4 | 5 | namespace Rabbit.Web.Mvc.WebApi.Routes 6 | { 7 | /// 8 | /// 一个抽象的WebApi路由器提供程序。 9 | /// 10 | public interface IHttpRouteProvider : IDependency 11 | { 12 | /// 13 | /// 获取路由信息。 14 | /// 15 | /// 路由集合。 16 | void GetRoutes(ICollection routes); 17 | } 18 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.Mvc/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Rabbit.Kernel/Works/IWorkContextStateProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Kernel.Works 4 | { 5 | /// 6 | /// 一个抽象的工作上下文状态提供者。 7 | /// 8 | public interface IWorkContextStateProvider : IDependency 9 | { 10 | /// 11 | /// 获取状态信值。 12 | /// 13 | /// 状态类型。 14 | /// 状态名称。 15 | /// 获取状态值的委托。 16 | Func Get(string name); 17 | } 18 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Mvc/ModelBinders/ModelBinderDescriptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | 4 | namespace Rabbit.Web.Mvc.Mvc.ModelBinders 5 | { 6 | /// 7 | /// 模型绑定程序描述符。 8 | /// 9 | public sealed class ModelBinderDescriptor 10 | { 11 | /// 12 | /// 类型。 13 | /// 14 | public Type Type { get; set; } 15 | 16 | /// 17 | /// 模型绑定者。 18 | /// 19 | public IModelBinder ModelBinder { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Web.SignalR/NullAssemblyLocator.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNet.SignalR.Hubs; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | 5 | namespace Rabbit.Components.Web.SignalR 6 | { 7 | internal sealed class NullAssemblyLocator : IAssemblyLocator 8 | { 9 | #region Implementation of IAssemblyLocator 10 | 11 | public IList GetAssemblies() 12 | { 13 | return new Assembly[0]; 14 | } 15 | 16 | #endregion Implementation of IAssemblyLocator 17 | } 18 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/FileSystems/VirtualPath/IVirtualPathMonitor.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Caching; 2 | 3 | namespace Rabbit.Kernel.FileSystems.VirtualPath 4 | { 5 | /// 6 | /// 一个抽象的虚拟路径监视者。 7 | /// 8 | public interface IVirtualPathMonitor : IVolatileProvider 9 | { 10 | /// 11 | /// 检测路径是否被更改。 12 | /// 13 | /// 需要监测的虚拟路径。 14 | /// 挥发令牌。 15 | IVolatileToken WhenPathChanges(string virtualPath); 16 | } 17 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/DisplayManagement/Implementation/IDisplayManager.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Web; 3 | 4 | namespace Rabbit.Web.Mvc.DisplayManagement.Implementation 5 | { 6 | /// 7 | /// 一个抽象的显示管理者。 8 | /// 9 | public interface IDisplayManager : IDependency 10 | { 11 | /// 12 | /// 执行。 13 | /// 14 | /// 显示上下文。 15 | /// Html字符串实例。 16 | IHtmlString Execute(DisplayContext context); 17 | } 18 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Mvc/ViewEngines/ThemeAwareness/IConfiguredEnginesCache.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System; 3 | using System.Web.Mvc; 4 | 5 | namespace Rabbit.Web.Mvc.Mvc.ViewEngines.ThemeAwareness 6 | { 7 | internal interface IConfiguredEnginesCache : ISingletonDependency 8 | { 9 | IViewEngine BindBareEngines(Func factory); 10 | 11 | IViewEngine BindShallowEngines(string themeName, Func factory); 12 | 13 | IViewEngine BindDeepEngines(string themeName, Func factory); 14 | } 15 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/ShellBuilders/IShellContextFactory.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Environment.Configuration; 2 | 3 | namespace Rabbit.Kernel.Environment.ShellBuilders 4 | { 5 | /// 6 | /// 一个抽象的外壳上下文工厂。 7 | /// 8 | public interface IShellContextFactory 9 | { 10 | /// 11 | /// 创建一个外壳上下文工厂。 12 | /// 13 | /// 外壳设置。 14 | /// 外壳上下文。 15 | ShellContext CreateShellContext(ShellSettings settings); 16 | } 17 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/ShellBuilders/Models/BlueprintItem.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Extensions.Models; 2 | using System; 3 | 4 | namespace Rabbit.Kernel.Environment.ShellBuilders.Models 5 | { 6 | /// 7 | /// 蓝图项。 8 | /// 9 | public class BlueprintItem 10 | { 11 | /// 12 | /// 类型。 13 | /// 14 | public Type Type { get; set; } 15 | 16 | /// 17 | /// 特性条目。 18 | /// 19 | public Feature Feature { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Mvc/ViewEngines/ThemeAwareness/IThemeAwareViewEngine.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Web.Mvc; 3 | 4 | namespace Rabbit.Web.Mvc.Mvc.ViewEngines.ThemeAwareness 5 | { 6 | internal interface IThemeAwareViewEngine : IDependency 7 | { 8 | ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName, bool useCache, bool useDeepPaths); 9 | 10 | ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache, bool useDeepPaths); 11 | } 12 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Extensions/Models/Feature.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Rabbit.Kernel.Extensions.Models 5 | { 6 | /// 7 | /// 特性条目。 8 | /// 9 | public sealed class Feature 10 | { 11 | /// 12 | /// 特性描述符。 13 | /// 14 | public FeatureDescriptor Descriptor { get; set; } 15 | 16 | /// 17 | /// 特性中可导出的类型。 18 | /// 19 | public IEnumerable ExportedTypes { get; set; } 20 | } 21 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Works/IWorkContextAccessor.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Works 2 | { 3 | /// 4 | /// 一个抽象的工作上下文访问器。 5 | /// 6 | public interface IWorkContextAccessor 7 | { 8 | /// 9 | /// 获取工作上下文。 10 | /// 11 | /// 工作上下文。 12 | WorkContext GetContext(); 13 | 14 | /// 15 | /// 创建一个工作上下文范围。 16 | /// 17 | /// 工作上下文范围。 18 | IWorkContextScope CreateWorkContextScope(); 19 | } 20 | } -------------------------------------------------------------------------------- /Tests/Rabbit.Kernel.Tests/Modules/Rabbit.Test/Module.txt: -------------------------------------------------------------------------------- 1 | Name: Test 2 | Category: Default 3 | Description: 测试模块 4 | FeatureDescription: 5 | Version: 1.0.0.0 6 | KernelVersion: 1.0.0.0 7 | Runtime: Autofac, Version=3.3.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da|Rabbit.Components.Caching.Memory, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 8 | WebSite: 9 | Company: 10 | Author: majian 11 | Tags: 12 | Dependencies: 13 | Features: 14 | Rabbit.Test.Feaure1: 15 | Name: Feaure1 16 | Description: Feaure1 17 | Category: Default -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security.Web/IRoleService.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Collections.Generic; 3 | 4 | namespace Rabbit.Components.Security.Web 5 | { 6 | /// 7 | /// 一个抽象的角色服务。 8 | /// 9 | public interface IRoleService : IDependency 10 | { 11 | /// 12 | /// 根级角色的名称获取该角色所拥有的权限。 13 | /// 14 | /// 角色名称。 15 | /// 该角色所拥有的权限。 16 | IEnumerable GetPermissionsForRoleByName(string name); 17 | } 18 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/Providers/IEntityFrameworkDataServicesProvider.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Components.Data.Providers; 2 | using System.Data.Entity.Core.Common; 3 | 4 | namespace Rabbit.Components.Data.EntityFramework.Providers 5 | { 6 | /// 7 | /// 一个抽象的EntityFramework数据服务提供程序。 8 | /// 9 | public interface IEntityFrameworkDataServicesProvider : IDataServicesProvider 10 | { 11 | /// 12 | /// 数据库提供服务。 13 | /// 14 | DbProviderServices Instance { get; } 15 | } 16 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security/Permissions/PermissionStereotype.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Rabbit.Components.Security.Permissions 4 | { 5 | /// 6 | /// 一个立体的许可类型。 7 | /// 8 | public class PermissionStereotype 9 | { 10 | /// 11 | /// 许可名称。 12 | /// 13 | public string Name { get; set; } 14 | 15 | /// 16 | /// 许可集合。 17 | /// 18 | public IEnumerable Permissions { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /Rabbit.Web/IHttpContextAccessor.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | 3 | namespace Rabbit.Web 4 | { 5 | /// 6 | /// 一个抽象的Http上下文访问器。 7 | /// 8 | public interface IHttpContextAccessor 9 | { 10 | /// 11 | /// 当前Http上下文。 12 | /// 13 | /// Http上下文。 14 | HttpContextBase Current(); 15 | 16 | /// 17 | /// 设置Http上下文。 18 | /// 19 | /// 存根。 20 | void Set(HttpContextBase stub); 21 | } 22 | } -------------------------------------------------------------------------------- /Rabbit.Web/UI/Navigation/INavigationProvider.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | 3 | namespace Rabbit.Web.UI.Navigation 4 | { 5 | /// 6 | /// 一个抽象的导航提供者。 7 | /// 8 | public interface INavigationProvider : IDependency 9 | { 10 | /// 11 | /// 导航菜单名称。 12 | /// 13 | string MenuName { get; } 14 | 15 | /// 16 | /// 获取导航。 17 | /// 18 | /// 导航建造者。 19 | void GetNavigation(NavigationBuilder builder); 20 | } 21 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/ShellBuilders/IMinimumShellDescriptorProvider.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Environment.Descriptor.Models; 2 | using System.Collections.Generic; 3 | 4 | namespace Rabbit.Kernel.Environment.ShellBuilders 5 | { 6 | /// 7 | /// 一个抽象的最新外壳描述符提供者。 8 | /// 9 | public interface IMinimumShellDescriptorProvider 10 | { 11 | /// 12 | /// 获取外壳描述符。 13 | /// 14 | /// 外壳特性描述符。 15 | void GetFeatures(ICollection features); 16 | } 17 | } -------------------------------------------------------------------------------- /Rabbit.Web/Themes/IThemeManager.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using Rabbit.Kernel.Extensions.Models; 3 | using System.Web.Routing; 4 | 5 | namespace Rabbit.Web.Themes 6 | { 7 | /// 8 | /// 一个抽象的主题管理者。 9 | /// 10 | public interface IThemeManager : IDependency 11 | { 12 | /// 13 | /// 获取当前请求的主题。 14 | /// 15 | /// 请求上下文。 16 | /// 主题。 17 | ExtensionDescriptorEntry GetRequestTheme(RequestContext requestContext); 18 | } 19 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Bus/Exceptions/RequestTimeoutException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Kernel.Bus.Exceptions 4 | { 5 | /// 6 | /// 请求超时异常。 7 | /// 8 | [Serializable] 9 | public sealed class RequestTimeoutException : ApplicationException 10 | { 11 | /// 12 | /// 初始化一个新的请求超时异常。 13 | /// 14 | /// 消息。 15 | public RequestTimeoutException(MessageBase message) 16 | : base(string.Format("Bus请求超时,{0}。", message)) 17 | { } 18 | } 19 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/DisplayManagement/INamedEnumerable.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Rabbit.Web.Mvc.DisplayManagement 4 | { 5 | /// 6 | /// 一个抽象的命名枚举。 7 | /// 8 | /// 类型。 9 | public interface INamedEnumerable : IEnumerable 10 | { 11 | /// 12 | /// 阵地。 13 | /// 14 | IEnumerable Positional { get; } 15 | 16 | /// 17 | /// 命名。 18 | /// 19 | IDictionary Named { get; } 20 | } 21 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/Assemblies/IAssemblyNameResolver.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Environment.Assemblies 2 | { 3 | /// 4 | /// 一个抽象的程序集名称解析器。 5 | /// 6 | public interface IAssemblyNameResolver 7 | { 8 | /// 9 | /// 排序。 10 | /// 11 | int Order { get; } 12 | 13 | /// 14 | /// 解析一个程序集短名称到一个完全名称。 15 | /// 16 | /// 程序集短名称。 17 | /// 程序集完全名称。 18 | string Resolve(string shortName); 19 | } 20 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/DisplayManagement/Descriptors/ShapeTable.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Rabbit.Web.Mvc.DisplayManagement.Descriptors 4 | { 5 | /// 6 | /// 形状表格。 7 | /// 8 | public sealed class ShapeTable 9 | { 10 | /// 11 | /// 描述符字典表。 12 | /// 13 | public IDictionary Descriptors { get; set; } 14 | 15 | /// 16 | /// 绑定字典表。 17 | /// 18 | public IDictionary Bindings { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Caching/ICacheHolder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Kernel.Caching 4 | { 5 | /// 6 | /// 一个抽象的缓存持有者。 7 | /// 8 | public interface ICacheHolder : ISingletonDependency 9 | { 10 | /// 11 | /// 获取缓存。 12 | /// 13 | /// 键类型。 14 | /// 结果类型。 15 | /// 组件类型。 16 | /// 缓存实例。 17 | ICache GetCache(Type component); 18 | } 19 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/ShellBuilders/IShellContainerRegistrations.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Rabbit.Kernel.Environment.ShellBuilders.Models; 3 | 4 | namespace Rabbit.Kernel.Environment.ShellBuilders 5 | { 6 | /// 7 | /// 一个抽象的外壳容器注册提供程序。 8 | /// 9 | public interface IShellContainerRegistrations 10 | { 11 | /// 12 | /// 注册动作。 13 | /// 14 | /// 容器建造者。 15 | /// 外壳蓝图。 16 | void Registrations(ContainerBuilder builder, ShellBlueprint blueprint); 17 | } 18 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.MySql/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Rabbit.Kernel/Localization/Services/ILocalizedStringManager.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Localization.Services 2 | { 3 | /// 4 | /// 一个抽象的本地化字符串管理者。 5 | /// 6 | public interface ILocalizedStringManager : IDependency 7 | { 8 | /// 9 | /// 获取本地化字符串。 10 | /// 11 | /// 作用范围。 12 | /// 文本。 13 | /// 文化名称。 14 | /// 本地化字符串。 15 | string GetLocalizedString(string scope, string text, string cultureName); 16 | } 17 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Caching/ICache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Kernel.Caching 4 | { 5 | /// 6 | /// 一个抽象的缓存。 7 | /// 8 | /// 键类型。 9 | /// 值类型。 10 | public interface ICache 11 | { 12 | /// 13 | /// 根据键获取一个缓存结果。 14 | /// 15 | /// 键。 16 | /// 获取上下文。 17 | /// 缓存结果。 18 | TResult Get(TKey key, Func, TResult> acquire); 19 | } 20 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/Configuration/TenantState.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Environment.Configuration 2 | { 3 | /// 4 | /// 租户状态。 5 | /// 6 | public enum TenantState 7 | { 8 | /// 9 | /// 未初始化。 10 | /// 11 | Uninitialized, 12 | 13 | /// 14 | /// 正在运行。 15 | /// 16 | Running, 17 | 18 | /// 19 | /// 关闭。 20 | /// 21 | Disabled, 22 | 23 | /// 24 | /// 无效。 25 | /// 26 | Invalid 27 | } 28 | } -------------------------------------------------------------------------------- /Rabbit.Web/Utility/Extensions/ExtensionDescriptorExtensions.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Extensions.Models; 2 | 3 | namespace Rabbit.Web.Utility.Extensions 4 | { 5 | /// 6 | /// 扩展描述符扩展方法。 7 | /// 8 | public static class ExtensionDescriptorExtensions 9 | { 10 | /// 11 | /// 获取基本主题。 12 | /// 13 | /// 扩展描述符。 14 | /// 基本主题。 15 | public static string GetBaseTheme(this ExtensionDescriptor descriptor) 16 | { 17 | return descriptor["BaseTheme"]; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security.Web/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Rabbit.Kernel/Localization/NullLocalizer.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Localization 2 | { 3 | /// 4 | /// 一个空的本地化实例。 5 | /// 6 | public static class NullLocalizer 7 | { 8 | static NullLocalizer() 9 | { 10 | Localizer = (format, args) => new LocalizedString((args == null || args.Length == 0) ? format : string.Format(format, args)); 11 | } 12 | 13 | private static readonly Localizer Localizer; 14 | 15 | /// 16 | /// 本地化实例。 17 | /// 18 | public static Localizer Instance { get { return Localizer; } } 19 | } 20 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/DisplayManagement/IDisplayHelperFactory.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Web.Mvc; 3 | 4 | namespace Rabbit.Web.Mvc.DisplayManagement 5 | { 6 | /// 7 | /// 一个抽象的显示助手工厂。 8 | /// 9 | public interface IDisplayHelperFactory : IDependency 10 | { 11 | /// 12 | /// 创建助手。 13 | /// 14 | /// 视图上下文。 15 | /// 视图数据容器。 16 | /// 显示助手。 17 | dynamic CreateHelper(ViewContext viewContext, IViewDataContainer viewDataContainer); 18 | } 19 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.Migrators/VersionTable.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator.VersionTableInfo; 2 | 3 | namespace Rabbit.Components.Data.Migrators 4 | { 5 | [VersionTableMetaData] 6 | public class VersionTable : DefaultVersionTableMetaData 7 | { 8 | private static string _tableName; 9 | 10 | #region Overrides of DefaultVersionTableMetaData 11 | 12 | public override string TableName => _tableName; 13 | 14 | #endregion Overrides of DefaultVersionTableMetaData 15 | 16 | public static void SetTableName(string tableName) 17 | { 18 | _tableName = tableName; 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.Mvc/DataBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | 3 | namespace Rabbit.Components.Data.Mvc 4 | { 5 | /// 6 | /// 数据建设者。 7 | /// 8 | public static class DataBuilderExtensions 9 | { 10 | /// 11 | /// 启用Mvc拦截器事物支持,当Action执行失败时执行事务回滚。 12 | /// 13 | /// 数据建设者。 14 | public static void EnableMvcFilterTransaction(this BuilderExtensions.IDataBuilder dataBuilder) 15 | { 16 | dataBuilder.KernelBuilder.RegisterExtension(typeof(DataBuilderExtensions).Assembly); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/WorkContextExtensions.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Rabbit.Kernel.Works; 3 | 4 | namespace Rabbit.Kernel 5 | { 6 | /// 7 | /// 工作上下文扩展方法。 8 | /// 9 | public static class WorkContextExtensions 10 | { 11 | /// 12 | /// 创建一个工作上下文范围。 13 | /// 14 | /// 容器。 15 | /// 工作上下文范围。 16 | public static IWorkContextScope CreateWorkContextScope(this ILifetimeScope lifetimeScope) 17 | { 18 | return lifetimeScope.Resolve().CreateWorkContextScope(); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Localization/Services/ICultureManager.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Works; 2 | 3 | namespace Rabbit.Kernel.Localization.Services 4 | { 5 | /// 6 | /// 一个抽象的文化管理者。 7 | /// 8 | public interface ICultureManager : IDependency 9 | { 10 | /// 11 | /// 获取当前文化。 12 | /// 13 | /// 工作上下文。 14 | /// 文化名称。 15 | string GetCurrentCulture(WorkContext workContext); 16 | 17 | /// 18 | /// 获取租户文化。 19 | /// 20 | /// 文化名称。 21 | string GetTenantCulture(); 22 | } 23 | } -------------------------------------------------------------------------------- /Rabbit.Web/Themes/Impl/SafeModeThemeSelector.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Routing; 2 | 3 | namespace Rabbit.Web.Themes.Impl 4 | { 5 | internal sealed class SafeModeThemeSelector : IThemeSelector 6 | { 7 | #region Implementation of IThemeSelector 8 | 9 | /// 10 | /// 根据当前请求获取主题。 11 | /// 12 | /// 请求上下文。 13 | /// 主题选择结果。 14 | public ThemeSelectorResult GetTheme(RequestContext context) 15 | { 16 | return new ThemeSelectorResult { Priority = -100, ThemeName = "Themes" }; 17 | } 18 | 19 | #endregion Implementation of IThemeSelector 20 | } 21 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Web.SignalR/BuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | 3 | namespace Rabbit.Components.Web.SignalR 4 | { 5 | /// 6 | /// 建设者扩展。 7 | /// 8 | public static class BuilderExtensions 9 | { 10 | /// 11 | /// 开启 SignalR 功能。 12 | /// 13 | /// Web建设者。 14 | public static Rabbit.Web.BuilderExtensions.IWebBuilder EnableSignalR(this Rabbit.Web.BuilderExtensions.IWebBuilder webBuilder) 15 | { 16 | webBuilder.KernelBuilder.RegisterExtension(typeof(BuilderExtensions).Assembly); 17 | return webBuilder; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.DataBase/Providers/IDbConnectionProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data; 3 | 4 | namespace Rabbit.Components.DataBase.Providers 5 | { 6 | /// 7 | /// 一个抽象的数据连接提供程序。 8 | /// 9 | public interface IDbConnectionProvider 10 | { 11 | /// 12 | /// 数据连接提供程序名称。 13 | /// 14 | string Name { get; } 15 | 16 | /// 17 | /// 创建一个数据连接。 18 | /// 19 | /// 参数。 20 | /// 数据连接。 21 | IDbConnection CreateDbConnection(IDictionary parameters); 22 | } 23 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/ShellBuilders/IShellContainerFactory.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Rabbit.Kernel.Environment.Configuration; 3 | using Rabbit.Kernel.Environment.ShellBuilders.Models; 4 | 5 | namespace Rabbit.Kernel.Environment.ShellBuilders 6 | { 7 | /// 8 | /// 一个抽象的外壳容器工厂。 9 | /// 10 | public interface IShellContainerFactory 11 | { 12 | /// 13 | /// 创建一个外壳容器。 14 | /// 15 | /// 外壳设置。 16 | /// 外壳蓝图。 17 | /// 外壳容器。 18 | ILifetimeScope CreateContainer(ShellSettings settings, ShellBlueprint blueprint); 19 | } 20 | } -------------------------------------------------------------------------------- /Rabbit.Web/Utility/Extensions/WorkContextExtensions.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Extensions.Models; 2 | using Rabbit.Kernel.Works; 3 | 4 | namespace Rabbit.Web.Utility.Extensions 5 | { 6 | /// 7 | /// 工作上下文扩展方法。 8 | /// 9 | public static class WorkContextExtensions 10 | { 11 | /// 12 | /// 获取当前主题。 13 | /// 14 | /// 工作上下文。 15 | /// 主题扩展描述符条目。 16 | public static ExtensionDescriptorEntry GetCurrentTheme(this WorkContext workContext) 17 | { 18 | return workContext.GetState("CurrentTheme"); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/Providers/SqlServerEntityFrameworkDataServicesProvider.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Components.Data.Providers; 2 | using System.Data.Entity.Core.Common; 3 | using System.Data.Entity.SqlServer; 4 | 5 | namespace Rabbit.Components.Data.EntityFramework.Providers 6 | { 7 | internal sealed class SqlServerEntityFrameworkDataServicesProvider : SqlServerDataServicesProvider, IEntityFrameworkDataServicesProvider 8 | { 9 | #region Implementation of IEntityFrameworkDataServicesProvider 10 | 11 | public DbProviderServices Instance { get { return SqlProviderServices.Instance; } } 12 | 13 | #endregion Implementation of IEntityFrameworkDataServicesProvider 14 | } 15 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/ShellBuilders/ICompositionStrategy.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Environment.Configuration; 2 | using Rabbit.Kernel.Environment.Descriptor.Models; 3 | using Rabbit.Kernel.Environment.ShellBuilders.Models; 4 | 5 | namespace Rabbit.Kernel.Environment.ShellBuilders 6 | { 7 | /// 8 | /// 一个抽象的组合策略。 9 | /// 10 | public interface ICompositionStrategy 11 | { 12 | /// 13 | /// 组合外壳蓝图。 14 | /// 15 | /// 外壳设置。 16 | /// 外壳描述符。 17 | /// 外壳蓝图。 18 | ShellBlueprint Compose(ShellSettings settings, ShellDescriptor descriptor); 19 | } 20 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Caching/ISignals.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Caching 2 | { 3 | /// 4 | /// 一个抽象的信号量挥发提供程序。 5 | /// 6 | public interface ISignals : IVolatileProvider 7 | { 8 | /// 9 | /// 触发信号。 10 | /// 11 | /// 信号类型。 12 | /// 信号值。 13 | void Trigger(T signal); 14 | 15 | /// 16 | /// 根据 获取挥发令牌。 17 | /// 18 | /// 信号类型。 19 | /// 信号值。 20 | /// 挥发令牌。 21 | IVolatileToken When(T signal); 22 | } 23 | } -------------------------------------------------------------------------------- /Rabbit.Web/Routes/IRoutePublisherEventHandler.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Collections.Generic; 3 | 4 | namespace Rabbit.Web.Routes 5 | { 6 | /// 7 | /// 一个抽象的录音发布者事件处理程序。 8 | /// 9 | public interface IRoutePublisherEventHandler : IDependency 10 | { 11 | /// 12 | /// 发布前。 13 | /// 14 | /// 路由描述符。 15 | void Publishing(IEnumerable routeDescriptors); 16 | 17 | /// 18 | /// 发布后。 19 | /// 20 | /// 路由描述符。 21 | void Published(IEnumerable routeDescriptors); 22 | } 23 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/GlobalConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Configuration; 3 | using System.Linq; 4 | 5 | namespace Rabbit.Components.Data.EntityFramework 6 | { 7 | internal sealed class GlobalConfig 8 | { 9 | public static bool AutomaticMigrationsEnabled = false; 10 | 11 | static GlobalConfig() 12 | { 13 | const string key = "Data.EntityFramework.AutomaticMigrationsEnabled"; 14 | var settings = ConfigurationManager.AppSettings; 15 | if (settings.AllKeys.Contains(key) && "true".Equals(settings[key], StringComparison.OrdinalIgnoreCase)) 16 | { 17 | AutomaticMigrationsEnabled = true; 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/DisplayManagement/Descriptors/ShapePlacementStrategy/PlacementFile.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Rabbit.Web.Mvc.DisplayManagement.Descriptors.ShapePlacementStrategy 4 | { 5 | internal class PlacementFile : PlacementNode 6 | { 7 | } 8 | 9 | internal class PlacementNode 10 | { 11 | public IEnumerable Nodes { get; set; } 12 | } 13 | 14 | internal class PlacementMatch : PlacementNode 15 | { 16 | public IDictionary Terms { get; set; } 17 | } 18 | 19 | internal class PlacementShapeLocation : PlacementNode 20 | { 21 | public string ShapeType { get; set; } 22 | 23 | public string Location { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Extensions/SuppressDependencyAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Kernel.Extensions 4 | { 5 | /// 6 | /// 替换依赖标记。 7 | /// 8 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] 9 | public sealed class SuppressDependencyAttribute : Attribute 10 | { 11 | /// 12 | /// 初始化一个新的替换依赖标记。 13 | /// 14 | /// 替换的类型名称。 15 | public SuppressDependencyAttribute(string fullName) 16 | { 17 | FullName = fullName; 18 | } 19 | 20 | /// 21 | /// 替换的类型名称。 22 | /// 23 | public string FullName { get; set; } 24 | } 25 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/UI/Admin/AdminThemeSelector.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Web.Themes; 2 | using System.Web.Routing; 3 | 4 | namespace Rabbit.Web.Mvc.UI.Admin 5 | { 6 | internal sealed class AdminThemeSelector : IThemeSelector 7 | { 8 | #region Implementation of IThemeSelector 9 | 10 | /// 11 | /// 根据当前请求获取主题。 12 | /// 13 | /// 请求上下文。 14 | /// 主题选择结果。 15 | public ThemeSelectorResult GetTheme(RequestContext context) 16 | { 17 | return AdminFilter.IsApplied(context) ? new ThemeSelectorResult { Priority = 100, ThemeName = "TheAdmin" } : null; 18 | } 19 | 20 | #endregion Implementation of IThemeSelector 21 | } 22 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.MySql/DataBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | 3 | namespace Rabbit.Components.Data.MySql 4 | { 5 | /// 6 | /// 数据建设者扩展方法。 7 | /// 8 | public static class DataBuilderExtensions 9 | { 10 | /// 11 | /// 添加MySql的提供程序。 12 | /// 13 | /// 数据建设者。 14 | /// 数据建设者。 15 | public static BuilderExtensions.IDataBuilder AddMySqlProvider(this BuilderExtensions.IDataBuilder dataBuilder) 16 | { 17 | dataBuilder.KernelBuilder 18 | .RegisterExtension(typeof(DataBuilderExtensions).Assembly); 19 | return dataBuilder; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Extensions/ExtensionEntry.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Extensions.Models; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Reflection; 5 | 6 | namespace Rabbit.Kernel.Extensions 7 | { 8 | /// 9 | /// 扩展条目。 10 | /// 11 | public class ExtensionEntry 12 | { 13 | /// 14 | /// 扩展描述符。 15 | /// 16 | public ExtensionDescriptorEntry Descriptor { get; set; } 17 | 18 | /// 19 | /// 扩展程序集。 20 | /// 21 | public Assembly Assembly { get; set; } 22 | 23 | /// 24 | /// 扩展导出类型集合。 25 | /// 26 | public IEnumerable ExportedTypes { get; set; } 27 | } 28 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Web.SignalR/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Rabbit.Web/UI/Navigation/INavigationManager.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Collections.Generic; 3 | 4 | namespace Rabbit.Web.UI.Navigation 5 | { 6 | /// 7 | /// 一个抽象的导航管理者。 8 | /// 9 | public interface INavigationManager : IDependency 10 | { 11 | /// 12 | /// 生成菜单。 13 | /// 14 | /// 菜单名称。 15 | /// 菜单项集合。 16 | IEnumerable BuildMenu(string menuName); 17 | 18 | /// 19 | /// 生成图片集。 20 | /// 21 | /// 菜单名称。 22 | /// 图片集。 23 | IEnumerable BuildImageSets(string menuName); 24 | } 25 | } -------------------------------------------------------------------------------- /Tests/Rabbit.Kernel.Tests/Extensions/ExtensionHarvesterTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using Rabbit.Kernel.Extensions.Folders; 3 | using System.Linq; 4 | 5 | namespace Rabbit.Kernel.Tests.Extensions 6 | { 7 | [TestClass] 8 | public sealed class ExtensionHarvesterTests : TestBase 9 | { 10 | public IExtensionHarvester ExtensionHarvester { get; set; } 11 | 12 | // public ILifetimeScope LifetimeScope { get; set; } 13 | 14 | [TestMethod] 15 | public void HarvestExtensionsTest() 16 | { 17 | var extensions = ExtensionHarvester.HarvestExtensions(new[] { "~/Modules" }, "Module", "Module.txt", false); 18 | 19 | Assert.IsTrue(extensions.Any()); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Extensions/FeatureAttribute.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Utility.Extensions; 2 | using System; 3 | 4 | namespace Rabbit.Kernel.Extensions 5 | { 6 | /// 7 | /// 特性标记。 8 | /// 9 | 10 | [AttributeUsage(AttributeTargets.Class)] 11 | public sealed class FeatureAttribute : Attribute 12 | { 13 | /// 14 | /// 初始化一个新的特性标记。 15 | /// 16 | /// 特性名称。 17 | public FeatureAttribute(string featureName) 18 | { 19 | FeatureName = featureName.NotEmptyOrWhiteSpace("name"); 20 | } 21 | 22 | /// 23 | /// 特性名称。 24 | /// 25 | public string FeatureName { get; private set; } 26 | } 27 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Caching/Impl/MemoryCachingBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | 3 | namespace Rabbit.Kernel.Caching.Impl 4 | { 5 | /// 6 | /// 缓存建设者扩展方法。 7 | /// 8 | public static class MemoryCachingBuilderExtensions 9 | { 10 | /// 11 | /// 使用内存缓存。 12 | /// 13 | /// 缓存建设者。 14 | public static void UseMemoryCache(this BuilderExtensions.ICachingBuilder cachingBuilder) 15 | { 16 | cachingBuilder.KernelBuilder 17 | .RegisterExtension(typeof(MemoryCachingBuilderExtensions).Assembly) 18 | .OnStarting(builder => builder.RegisterType().As().SingleInstance()); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.Migrators.MySql/DataBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | 3 | namespace Rabbit.Components.Data.Migrators.MySql 4 | { 5 | /// 6 | /// 数据建设者扩展方法。 7 | /// 8 | public static class DataBuilderExtensions 9 | { 10 | /// 11 | /// 添加MySql迁移的支持程序。 12 | /// 13 | /// 数据建设者。 14 | /// 数据建设者。 15 | public static BuilderExtensions.IDataBuilder AddMySqlMigratorProvider(this BuilderExtensions.IDataBuilder dataBuilder) 16 | { 17 | dataBuilder.KernelBuilder 18 | .RegisterExtension(typeof(DataBuilderExtensions).Assembly); 19 | return dataBuilder; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.Migrators/Providers/IMigratorDataServicesProvider.cs: -------------------------------------------------------------------------------- 1 | using FluentMigrator; 2 | using FluentMigrator.Runner.Initialization; 3 | using Rabbit.Components.Data.Providers; 4 | using System.Data; 5 | 6 | namespace Rabbit.Components.Data.Migrators.Providers 7 | { 8 | /// 9 | /// 一个抽象的数据迁移服务提供程序。 10 | /// 11 | public interface IMigratorDataServicesProvider : IDataServicesProvider 12 | { 13 | /// 14 | /// 创建迁移处理器。 15 | /// 16 | /// 运行上下文。 17 | /// 数据库连接。 18 | /// 迁移处理器。 19 | IMigrationProcessor CreateMigrationProcessor(RunnerContext context, IDbConnection connection); 20 | } 21 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Themes/ThemedAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Web.Mvc.Themes 4 | { 5 | /// 6 | /// 主题标记。 7 | /// 8 | public sealed class ThemedAttribute : Attribute 9 | { 10 | /// 11 | /// 初始化一个新的主题标记。 12 | /// 13 | public ThemedAttribute() 14 | { 15 | Enabled = true; 16 | } 17 | 18 | /// 19 | /// 初始化一个新的主题标记。 20 | /// 21 | /// 是否启用主题。 22 | public ThemedAttribute(bool enabled) 23 | { 24 | Enabled = enabled; 25 | } 26 | 27 | /// 28 | /// 是否启用主题。 29 | /// 30 | public bool Enabled { get; set; } 31 | } 32 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/Descriptor/IShellDescriptorCache.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Environment.Descriptor.Models; 2 | 3 | namespace Rabbit.Kernel.Environment.Descriptor 4 | { 5 | /// 6 | /// 一个抽象的外壳描述符缓存。 7 | /// 8 | public interface IShellDescriptorCache 9 | { 10 | /// 11 | /// 从缓存中抓取外壳描述符。 12 | /// 13 | /// 外壳名称。 14 | /// 外壳描述符。 15 | ShellDescriptor Fetch(string shellName); 16 | 17 | /// 18 | /// 将一个外壳描述符存储到缓存中。 19 | /// 20 | /// 外壳名称。 21 | /// 外壳描述符。 22 | void Store(string shellName, ShellDescriptor descriptor); 23 | } 24 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/DisplayManagement/ShapeAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Web.Mvc.DisplayManagement 4 | { 5 | /// 6 | /// 形状标记。 7 | /// 8 | public sealed class ShapeAttribute : Attribute 9 | { 10 | /// 11 | /// 初始化一个新的形状标记。 12 | /// 13 | public ShapeAttribute() 14 | { 15 | } 16 | 17 | /// 18 | /// 初始化一个新的形状标记。 19 | /// 20 | /// 形状类型。 21 | public ShapeAttribute(string shapeType) 22 | { 23 | ShapeType = shapeType; 24 | } 25 | 26 | /// 27 | /// 形状类型。 28 | /// 29 | public string ShapeType { get; private set; } 30 | } 31 | } -------------------------------------------------------------------------------- /Rabbit.Web/Works/IWebWorkContextAccessor.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Works; 2 | using System.Web; 3 | 4 | namespace Rabbit.Web.Works 5 | { 6 | /// 7 | /// 一个抽象的Web上下文访问者。 8 | /// 9 | public interface IWebWorkContextAccessor : IWorkContextAccessor 10 | { 11 | /// 12 | /// 获取工作上下文。 13 | /// 14 | /// Http上下文。 15 | /// 工作上下文。 16 | WorkContext GetContext(HttpContextBase httpContext); 17 | 18 | /// 19 | /// 创建工作上下文范围。 20 | /// 21 | /// Http上下文。 22 | /// 工作上下文范围。 23 | IWorkContextScope CreateWorkContextScope(HttpContextBase httpContext); 24 | } 25 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/DisplayManagement/Implementation/DisplayContext.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | 3 | namespace Rabbit.Web.Mvc.DisplayManagement.Implementation 4 | { 5 | /// 6 | /// 显示上下文。 7 | /// 8 | public sealed class DisplayContext 9 | { 10 | /// 11 | /// 显示助手。 12 | /// 13 | public DisplayHelper Display { get; set; } 14 | 15 | /// 16 | /// 视图上下文。 17 | /// 18 | public ViewContext ViewContext { get; set; } 19 | 20 | /// 21 | /// 视图数据容器。 22 | /// 23 | public IViewDataContainer ViewDataContainer { get; set; } 24 | 25 | /// 26 | /// 值。 27 | /// 28 | public object Value { get; set; } 29 | } 30 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security/CheckAccessContext.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Components.Security.Permissions; 2 | 3 | namespace Rabbit.Components.Security 4 | { 5 | /// 6 | /// 检查访问许可上下文。 7 | /// 8 | public class CheckAccessContext 9 | { 10 | /// 11 | /// 许可模型。 12 | /// 13 | public Permission Permission { get; set; } 14 | 15 | /// 16 | /// 需要被检查的用户。 17 | /// 18 | public IUser User { get; set; } 19 | 20 | /// 21 | /// 是否通过许可认证。 22 | /// 23 | public bool Granted { get; set; } 24 | 25 | /// 26 | /// 允许外部事件进行权限调整,如果为true框架则会再次进行权限检查,上限为3次。 27 | /// 28 | public bool Adjusted { get; set; } 29 | } 30 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Extensions/Folders/IExtensionHarvester.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Extensions.Models; 2 | using System.Collections.Generic; 3 | 4 | namespace Rabbit.Kernel.Extensions.Folders 5 | { 6 | /// 7 | /// 一个抽象的扩展收集者。 8 | /// 9 | public interface IExtensionHarvester 10 | { 11 | /// 12 | /// 收集扩展。 13 | /// 14 | /// 需要进行收集的路径。 15 | /// 扩展类型。 16 | /// 清单文件名称。 17 | /// 清单文件是否是可选的。 18 | /// 扩展描述符集合。 19 | IEnumerable HarvestExtensions(IEnumerable paths, string extensionType, string manifestName, bool manifestIsOptional); 20 | } 21 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data/Providers/IDataServicesProvider.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Data.Common; 3 | 4 | namespace Rabbit.Components.Data.Providers 5 | { 6 | /// 7 | /// 一个抽象的数据服务提供程序。 8 | /// 9 | public interface IDataServicesProvider : ITransientDependency 10 | { 11 | /// 12 | /// 提供程序名称。 13 | /// 14 | string ProviderName { get; } 15 | 16 | /// 17 | /// 提供程序不变的名称。 18 | /// 19 | string ProviderInvariantName { get; } 20 | 21 | /// 22 | /// 创建一个数据库连接。 23 | /// 24 | /// 连接字符串。 25 | /// 数据库连接。 26 | DbConnection CreateConnection(string connectionString); 27 | } 28 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Mvc/Html/HtmlHelperExtensions.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Works; 2 | using Rabbit.Web.Works; 3 | using System; 4 | using System.Web.Mvc; 5 | 6 | namespace Rabbit.Web.Mvc.Mvc.Html 7 | { 8 | /// 9 | /// Html助手扩展方法。 10 | /// 11 | public static class HtmlHelperExtensions 12 | { 13 | /// 14 | /// 获取工作上下文。 15 | /// 16 | /// Html助手。 17 | /// 工作上下文。 18 | public static WorkContext GetWorkContext(this HtmlHelper html) 19 | { 20 | var workContext = html.ViewContext.RequestContext.GetWorkContext(); 21 | 22 | if (workContext == null) 23 | throw new ApplicationException("在请求中无法找到工作上下文。"); 24 | 25 | return workContext; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/Configuration/IShellSettingsManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Rabbit.Kernel.Environment.Configuration 4 | { 5 | /// 6 | /// 一个抽象的外壳设置管理者。 7 | /// 8 | public interface IShellSettingsManager 9 | { 10 | /// 11 | /// 加载所有外壳设置。 12 | /// 13 | /// 外壳设置集合。 14 | IEnumerable LoadSettings(); 15 | 16 | /// 17 | /// 保存一个外壳设置。 18 | /// 19 | /// 外壳设置信息。 20 | void SaveSettings(ShellSettings settings); 21 | 22 | /// 23 | /// 删除一个外壳设置。 24 | /// 25 | /// 外壳名称。 26 | void DeleteSettings(string name); 27 | } 28 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/FileSystems/VirtualPath/Impl/DefaultVirtualPathProvider.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Environment; 2 | 3 | namespace Rabbit.Kernel.FileSystems.VirtualPath.Impl 4 | { 5 | internal sealed class DefaultVirtualPathProvider : VirtualPathProviderBase, IVirtualPathProvider 6 | { 7 | #region Constructor 8 | 9 | public DefaultVirtualPathProvider(IHostEnvironment hostEnvironment) 10 | : base(hostEnvironment) 11 | { 12 | } 13 | 14 | #endregion Constructor 15 | 16 | #region Overrides of VirtualPathProviderBase 17 | 18 | /// 19 | /// 根文件夹虚拟路径 ~/ or ~/Abc 20 | /// 21 | public override string RootPath 22 | { 23 | get { return "~/"; } 24 | } 25 | 26 | #endregion Overrides of VirtualPathProviderBase 27 | } 28 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Logging.NLog/MinimumShellDescriptorProvider.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Environment.Descriptor.Models; 2 | using Rabbit.Kernel.Environment.ShellBuilders; 3 | using System.Collections.Generic; 4 | 5 | namespace Rabbit.Components.Logging.NLog 6 | { 7 | internal sealed class MinimumShellDescriptorProvider : IMinimumShellDescriptorProvider 8 | { 9 | #region Implementation of IMinimumShellDescriptorProvider 10 | 11 | /// 12 | /// 获取外壳描述符。 13 | /// 14 | /// 外壳特性描述符。 15 | public void GetFeatures(ICollection features) 16 | { 17 | features.Add(new ShellFeature { Name = "Rabbit.Components.Logging.NLog" }); 18 | } 19 | 20 | #endregion Implementation of IMinimumShellDescriptorProvider 21 | } 22 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security.Web/WebSecurityBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using BuilderExtensions = Rabbit.Web.BuilderExtensions; 3 | 4 | namespace Rabbit.Components.Security.Web 5 | { 6 | /// 7 | /// 日志建设者扩展方法。 8 | /// 9 | public static class WebSecurityBuilderExtensions 10 | { 11 | /// 12 | /// 使用NLog。 13 | /// 14 | /// Web建设者。 15 | public static BuilderExtensions.IWebBuilder EnableSecurity(this BuilderExtensions.IWebBuilder webBuilder) 16 | { 17 | webBuilder.KernelBuilder 18 | .RegisterExtension(typeof(IAuthorizer).Assembly) 19 | .RegisterExtension(typeof(IRoleService).Assembly); 20 | 21 | return webBuilder; 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security/IAuthorizationServiceEventHandler.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Events; 2 | 3 | namespace Rabbit.Components.Security 4 | { 5 | /// 6 | /// 一个抽象的授权服务事件处理程序。 7 | /// 8 | public interface IAuthorizationServiceEventHandler : IEventHandler 9 | { 10 | /// 11 | /// 检查前执行。 12 | /// 13 | /// 14 | void Checking(CheckAccessContext context); 15 | 16 | /// 17 | /// 调整完成后执行。 18 | /// 19 | /// 20 | void Adjust(CheckAccessContext context); 21 | 22 | /// 23 | /// 授权完成后执行。 24 | /// 25 | /// 26 | void Complete(CheckAccessContext context); 27 | } 28 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data/DataAnnotations/ForeignKeyAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Components.Data.DataAnnotations 4 | { 5 | /// 6 | /// 外键标记。 7 | /// 8 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)] 9 | public sealed class ForeignKeyAttribute : Attribute 10 | { 11 | /// 12 | /// 外键名称。 13 | /// 14 | public string Name { get; private set; } 15 | 16 | /// 17 | /// 初始化一个新的外键标记。 18 | /// 19 | /// 外键名称。 20 | public ForeignKeyAttribute(string name) 21 | { 22 | if (string.IsNullOrWhiteSpace(name)) 23 | throw new ArgumentNullException("name"); 24 | Name = name; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security/Permissions/IPermissionProvider.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using Rabbit.Kernel.Extensions.Models; 3 | using System.Collections.Generic; 4 | 5 | namespace Rabbit.Components.Security.Permissions 6 | { 7 | /// 8 | /// 一个抽象的许可提供程序。 9 | /// 10 | public interface IPermissionProvider : IDependency 11 | { 12 | /// 13 | /// 功能。 14 | /// 15 | Feature Feature { get; } 16 | 17 | /// 18 | /// 获取许可集合。 19 | /// 20 | /// 许可集合。 21 | IEnumerable GetPermissions(); 22 | 23 | /// 24 | /// 获取默认的立体许可集合。 25 | /// 26 | /// 立体许可集合。 27 | IEnumerable GetDefaultStereotypes(); 28 | } 29 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework.MySql/DataBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | 3 | namespace Rabbit.Components.Data.EntityFramework.MySql 4 | { 5 | /// 6 | /// 数据建设者扩展方法。 7 | /// 8 | public static class DataBuilderExtensions 9 | { 10 | /// 11 | /// 添加MySql迁移的支持程序。 12 | /// 13 | /// EntityFramework提供程序建设者。 14 | /// EntityFramework提供程序建设者。 15 | public static EntityFramework.DataBuilderExtensions.EntityFrameworkProviderBuilder AddMySql(this EntityFramework.DataBuilderExtensions.EntityFrameworkProviderBuilder builder) 16 | { 17 | builder.KernelBuilder 18 | .RegisterExtension(typeof(DataBuilderExtensions).Assembly); 19 | return builder; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Caching/Impl/DefaultCacheContextAccessor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Kernel.Caching.Impl 4 | { 5 | internal sealed class DefaultCacheContextAccessor : ICacheContextAccessor 6 | { 7 | [ThreadStatic] 8 | private static IAcquireContext _threadInstance; 9 | 10 | private static IAcquireContext ThreadInstance 11 | { 12 | get { return _threadInstance; } 13 | set { _threadInstance = value; } 14 | } 15 | 16 | #region Implementation of ICacheContextAccessor 17 | 18 | /// 19 | /// 当前获取上下文。 20 | /// 21 | public IAcquireContext Current 22 | { 23 | get { return ThreadInstance; } 24 | set { ThreadInstance = value; } 25 | } 26 | 27 | #endregion Implementation of ICacheContextAccessor 28 | } 29 | } -------------------------------------------------------------------------------- /Tests/Rabbit.Kernel.Tests/Config/Logging/LoggingConfig.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data/ITransactionManager.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Data; 3 | 4 | namespace Rabbit.Components.Data 5 | { 6 | /// 7 | /// 一个抽象的事务管理者。 8 | /// 9 | public interface ITransactionManager : IDependency 10 | { 11 | /// 12 | /// 索取一个事务。 13 | /// 14 | void Demand(); 15 | 16 | /// 17 | /// 索取一个锁行为为 的新事务。 18 | /// 19 | void RequireNew(); 20 | 21 | /// 22 | /// 索取一个锁行为为 的新事务。 23 | /// 24 | /// 事务锁定行为。 25 | void RequireNew(IsolationLevel level); 26 | 27 | /// 28 | /// 取消事务。 29 | /// 30 | void Cancel(); 31 | } 32 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/ShellBuilders/Impl/DefaultServiceTypeHarvester.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Utility.Extensions; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace Rabbit.Kernel.Environment.ShellBuilders.Impl 7 | { 8 | internal sealed class DefaultServiceTypeHarvester : IServiceTypeHarvester 9 | { 10 | #region Implementation of IServiceTypeHarvester 11 | 12 | /// 13 | /// 获取可用的服务类型。 14 | /// 15 | /// 类型集合。 16 | /// 可用的服务类型。 17 | public Type[] GeTypes(IEnumerable types) 18 | { 19 | types = types.NotNull("types").ToArray(); 20 | return types.Where(i => i.IsClass && !i.IsAbstract).ToArray(); 21 | } 22 | 23 | #endregion Implementation of IServiceTypeHarvester 24 | } 25 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Works/MvcWorkContext.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Works; 2 | using Rabbit.Web.Works; 3 | 4 | namespace Rabbit.Web.Mvc.Works 5 | { 6 | /// 7 | /// Web工作上下文。 8 | /// 9 | public sealed class MvcWorkContext : WebWorkContext 10 | { 11 | #region Constructor 12 | 13 | /// 14 | /// 初始化一个新的Web工作上下文。 15 | /// 16 | /// 工作上下文。 17 | public MvcWorkContext(WorkContext workContext) 18 | : base(workContext) 19 | { 20 | } 21 | 22 | #endregion Constructor 23 | 24 | /// 25 | /// 对应的工作范围内的布局形状。 26 | /// 27 | public dynamic Layout 28 | { 29 | get { return GetState("Layout"); } 30 | set { SetState("Layout", value); } 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Rabbit.Web/Themes/IThemeSelector.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Web.Routing; 3 | 4 | namespace Rabbit.Web.Themes 5 | { 6 | /// 7 | /// 主题选择结果。 8 | /// 9 | public class ThemeSelectorResult 10 | { 11 | /// 12 | /// 优先级。 13 | /// 14 | public int Priority { get; set; } 15 | 16 | /// 17 | /// 主题名称。 18 | /// 19 | public string ThemeName { get; set; } 20 | } 21 | 22 | /// 23 | /// 一个抽象的主题选择器。 24 | /// 25 | public interface IThemeSelector : IDependency 26 | { 27 | /// 28 | /// 根据当前请求获取主题。 29 | /// 30 | /// 请求上下文。 31 | /// 主题选择结果。 32 | ThemeSelectorResult GetTheme(RequestContext context); 33 | } 34 | } -------------------------------------------------------------------------------- /Tests/Rabbit.Kernel.Tests/Environment/HostEnvironmentTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using Rabbit.Kernel.Environment; 3 | 4 | namespace Rabbit.Kernel.Tests.Environment 5 | { 6 | [TestClass] 7 | public sealed class HostEnvironmentTests : TestBase 8 | { 9 | #region Property 10 | 11 | public IHostEnvironment HostEnvironment { get; set; } 12 | 13 | #endregion Property 14 | 15 | #region Test Method 16 | 17 | [TestMethod] 18 | public void IsAssemblyLoadedTest() 19 | { 20 | Assert.IsTrue(HostEnvironment.IsAssemblyLoaded("system")); 21 | Assert.IsTrue(HostEnvironment.IsAssemblyLoaded(typeof(string).Assembly.FullName)); 22 | Assert.IsTrue(HostEnvironment.IsAssemblyLoaded(typeof(string).Assembly.FullName.ToLower())); 23 | } 24 | 25 | #endregion Test Method 26 | } 27 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Works/IWorkContextScope.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Kernel.Works 4 | { 5 | /// 6 | /// 一个抽象的工作上下文范围。 7 | /// 8 | public interface IWorkContextScope : IDisposable 9 | { 10 | /// 11 | /// 工作上下文。 12 | /// 13 | WorkContext WorkContext { get; } 14 | 15 | /// 16 | /// 解析一个服务。 17 | /// 18 | /// 服务类型。 19 | /// 服务实例。 20 | TService Resolve(); 21 | 22 | /// 23 | /// 尝试解析一个服务。 24 | /// 25 | /// 服务类型。 26 | /// 服务实例。 27 | /// 如果解析成功则返回true,否则返回false。 28 | bool TryResolve(out TService service); 29 | } 30 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data/DataAnnotations/InversePropertyAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Components.Data.DataAnnotations 4 | { 5 | /// 6 | /// 依赖倒转属性标记。 7 | /// 8 | [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)] 9 | public sealed class InversePropertyAttribute : Attribute 10 | { 11 | /// 12 | /// 属性名称。 13 | /// 14 | public string Property { get; private set; } 15 | 16 | /// 17 | /// 初始化一个新的依赖倒转属性标记。 18 | /// 19 | /// 属性名称。 20 | public InversePropertyAttribute(string property) 21 | { 22 | if (string.IsNullOrWhiteSpace(property)) 23 | throw new ArgumentNullException("property"); 24 | Property = property; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/DisplayManagement/Implementation/DisplayHelperFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | 3 | namespace Rabbit.Web.Mvc.DisplayManagement.Implementation 4 | { 5 | internal sealed class DisplayHelperFactory : IDisplayHelperFactory 6 | { 7 | private readonly IDisplayManager _displayManager; 8 | private readonly IShapeFactory _shapeFactory; 9 | 10 | public DisplayHelperFactory(IDisplayManager displayManager, IShapeFactory shapeFactory) 11 | { 12 | _displayManager = displayManager; 13 | _shapeFactory = shapeFactory; 14 | } 15 | 16 | public dynamic CreateHelper(ViewContext viewContext, IViewDataContainer viewDataContainer) 17 | { 18 | return new DisplayHelper( 19 | _displayManager, 20 | _shapeFactory, 21 | viewContext, 22 | viewDataContainer); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Localization/Services/ICultureSelector.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Works; 2 | 3 | namespace Rabbit.Kernel.Localization.Services 4 | { 5 | /// 6 | /// 文化选择结果。 7 | /// 8 | public class CultureSelectorResult 9 | { 10 | /// 11 | /// 优先级。 12 | /// 13 | public int Priority { get; set; } 14 | 15 | /// 16 | /// 文化名称。 17 | /// 18 | public string CultureName { get; set; } 19 | } 20 | 21 | /// 22 | /// 一个抽象的文化选择器。 23 | /// 24 | public interface ICultureSelector : IDependency 25 | { 26 | /// 27 | /// 根据工作上下文获取文化。 28 | /// 29 | /// 工作上下文。 30 | /// 文化选择结果。 31 | CultureSelectorResult GetCulture(WorkContext workContext); 32 | } 33 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/FileSystems/Application/Impl/DefaultApplicationFolder.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Environment; 2 | using Rabbit.Kernel.FileSystems.VirtualPath; 3 | 4 | namespace Rabbit.Kernel.FileSystems.Application.Impl 5 | { 6 | internal sealed class DefaultApplicationFolder : FolderBase, IApplicationFolder 7 | { 8 | #region Constructor 9 | 10 | public DefaultApplicationFolder(IHostEnvironment hostEnvironment, IVirtualPathMonitor virtualPathMonitor) 11 | : base(hostEnvironment, virtualPathMonitor) 12 | { 13 | } 14 | 15 | #endregion Constructor 16 | 17 | #region Overrides of VirtualPathProviderBase 18 | 19 | /// 20 | /// 根文件夹虚拟路径 ~/ or ~/Abc 21 | /// 22 | public override string RootPath 23 | { 24 | get { return "~/"; } 25 | } 26 | 27 | #endregion Overrides of VirtualPathProviderBase 28 | } 29 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Web.SignalR/RabbitHubConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNet.SignalR; 2 | 3 | namespace Rabbit.Components.Web.SignalR 4 | { 5 | internal sealed class RabbitHubConfiguration : IRabbitHubConfiguration 6 | { 7 | #region Field 8 | 9 | private readonly IDependencyResolver _dependencyResolver; 10 | 11 | #endregion Field 12 | 13 | #region Constructor 14 | 15 | public RabbitHubConfiguration(IDependencyResolver dependencyResolver) 16 | { 17 | _dependencyResolver = dependencyResolver; 18 | } 19 | 20 | #endregion Constructor 21 | 22 | #region Implementation of IRabbitHubConfiguration 23 | 24 | public HubConfiguration ConnectionConfiguration 25 | { 26 | get { return new HubConfiguration { Resolver = _dependencyResolver }; } 27 | } 28 | 29 | #endregion Implementation of IRabbitHubConfiguration 30 | } 31 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/IHostEnvironment.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Kernel.Environment 2 | { 3 | /// 4 | /// 一个抽象的主机运行环境。 5 | /// 6 | public interface IHostEnvironment 7 | { 8 | /// 9 | /// 是否以完全信任模式运行。 10 | /// 11 | bool IsFullTrust { get; } 12 | 13 | /// 14 | /// 根据虚拟路径获取物理路径。 15 | /// 16 | /// 虚拟路径。 17 | /// 物理路径。 18 | string MapPath(string virtualPath); 19 | 20 | /// 21 | /// 根据程序集名称判断程序集是否已经被加载。 22 | /// 23 | /// 程序集名称。 24 | /// 如果已经被加载则返回true,否则返回false。 25 | bool IsAssemblyLoaded(string assemblyName); 26 | 27 | /// 28 | /// 重新启动AppDmain。 29 | /// 30 | void RestartAppDomain(); 31 | } 32 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Tasks/IBackgroundServiceEvents.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Events; 2 | using System; 3 | 4 | namespace Rabbit.Kernel.Tasks 5 | { 6 | /// 7 | /// 一个抽象的后台服务事件。 8 | /// 9 | public interface IBackgroundServiceEvents : IEventHandler 10 | { 11 | /// 12 | /// 开始扫描前执行。 13 | /// 14 | /// 后台任务实例。 15 | void Sweeping(IBackgroundTask backgroundTask); 16 | 17 | /// 18 | /// 在扫描过程中发生异常时执行。 19 | /// 20 | /// 后台任务实例。 21 | /// 异常信息。 22 | void OnException(IBackgroundTask backgroundTask, Exception exception); 23 | 24 | /// 25 | /// 扫描结束时执行。 26 | /// 27 | /// 后台任务实例。 28 | void Sweeped(IBackgroundTask backgroundTask); 29 | } 30 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/DisplayManagement/Descriptors/ShapeTableLocator.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System.Collections.Concurrent; 3 | 4 | namespace Rabbit.Web.Mvc.DisplayManagement.Descriptors 5 | { 6 | internal interface IShapeTableLocator : IUnitOfWorkDependency 7 | { 8 | ShapeTable Lookup(string themeName); 9 | } 10 | 11 | internal class ShapeTableLocator : IShapeTableLocator 12 | { 13 | private readonly IShapeTableManager _shapeTableManager; 14 | private readonly ConcurrentDictionary _shapeTables = new ConcurrentDictionary(); 15 | 16 | public ShapeTableLocator(IShapeTableManager shapeTableManager) 17 | { 18 | _shapeTableManager = shapeTableManager; 19 | } 20 | 21 | public ShapeTable Lookup(string themeName) 22 | { 23 | return _shapeTables.GetOrAdd(themeName ?? "", _ => _shapeTableManager.GetShapeTable(themeName)); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework.MySql/MySqlEntityFrameworkDataServicesProvider.cs: -------------------------------------------------------------------------------- 1 | using MySql.Data.MySqlClient; 2 | using Rabbit.Components.Data.EntityFramework.Providers; 3 | using Rabbit.Components.Data.MySql; 4 | using System.Data.Entity.Core.Common; 5 | 6 | namespace Rabbit.Components.Data.EntityFramework.MySql 7 | { 8 | /// 9 | /// MySql EntityFramework 数据服务提供程序。 10 | /// 11 | public class MySqlEntityFrameworkDataServicesProvider : MySqlDataServicesProvider, IEntityFrameworkDataServicesProvider 12 | { 13 | private static readonly MySqlProviderServices ProviderInstance = new MySqlProviderServices(); 14 | 15 | #region Implementation of IEntityFrameworkDataServicesProvider 16 | 17 | /// 18 | /// 数据库提供服务。 19 | /// 20 | public DbProviderServices Instance => ProviderInstance; 21 | 22 | #endregion Implementation of IEntityFrameworkDataServicesProvider 23 | } 24 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Works/Work.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Kernel.Works 4 | { 5 | /// 6 | /// 工作实例代理。 7 | /// 8 | /// 实例类型。 9 | public sealed class Work where T : class 10 | { 11 | #region Field 12 | 13 | private readonly Func, T> _resolve; 14 | 15 | #endregion Field 16 | 17 | #region Constructor 18 | 19 | /// 20 | /// 初始化一个新的工作实例代理。 21 | /// 22 | /// 解析器。 23 | public Work(Func, T> resolve) 24 | { 25 | _resolve = resolve; 26 | } 27 | 28 | #endregion Constructor 29 | 30 | #region Property 31 | 32 | /// 33 | /// 实例值。 34 | /// 35 | public T Value 36 | { 37 | get { return _resolve(this); } 38 | } 39 | 40 | #endregion Property 41 | } 42 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Command/CommandAction.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Components.Command 2 | { 3 | /// 4 | /// 命令的动作。 5 | /// 6 | public enum CommandAction 7 | { 8 | /// 9 | /// 空。 10 | /// 11 | None, 12 | 13 | /// 14 | /// 获取。 15 | /// 16 | Get, 17 | 18 | /// 19 | /// 添加。 20 | /// 21 | Add, 22 | 23 | /// 24 | /// 发送。 25 | /// 26 | Send, 27 | 28 | /// 29 | /// 删除。 30 | /// 31 | Remove, 32 | 33 | /// 34 | /// 删除。 35 | /// 36 | Delete, 37 | 38 | /// 39 | /// 设置。 40 | /// 41 | Set, 42 | 43 | /// 44 | /// 更新。 45 | /// 46 | Update 47 | } 48 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/DisplayManagement/IShapeDisplay.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using Rabbit.Web.Mvc.DisplayManagement.Shapes; 3 | using System.Collections.Generic; 4 | 5 | namespace Rabbit.Web.Mvc.DisplayManagement 6 | { 7 | /// 8 | /// 一个抽象的形状显示。 9 | /// 10 | public interface IShapeDisplay : IDependency 11 | { 12 | /// 13 | /// 显示。 14 | /// 15 | /// 形状。 16 | /// 结果。 17 | string Display(Shape shape); 18 | 19 | /// 20 | /// 显示。 21 | /// 22 | /// 形状。 23 | /// 结果。 24 | string Display(object shape); 25 | 26 | /// 27 | /// 显示。 28 | /// 29 | /// 形状集合。 30 | /// 结果集合。 31 | IEnumerable Display(IEnumerable shapes); 32 | } 33 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.Mvc/TransactionFilter.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Mvc; 2 | using IFilterProvider = Rabbit.Web.Mvc.Mvc.Filters.IFilterProvider; 3 | 4 | namespace Rabbit.Components.Data.Mvc 5 | { 6 | /// 7 | /// 事务过滤器。 8 | /// 9 | internal sealed class TransactionFilter : IFilterProvider, IExceptionFilter 10 | { 11 | private readonly ITransactionManager _transactionManager; 12 | 13 | public TransactionFilter(ITransactionManager transactionManager) 14 | { 15 | _transactionManager = transactionManager; 16 | } 17 | 18 | #region Implementation of IExceptionFilter 19 | 20 | /// 21 | /// 在发生异常时调用。 22 | /// 23 | /// 筛选器上下文。 24 | public void OnException(ExceptionContext filterContext) 25 | { 26 | _transactionManager.Cancel(); 27 | } 28 | 29 | #endregion Implementation of IExceptionFilter 30 | } 31 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.DataBase/BuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Rabbit.Components.DataBase.Providers; 3 | using Rabbit.Kernel; 4 | 5 | namespace Rabbit.Components.DataBase 6 | { 7 | /// 8 | /// 建设者扩展方法。 9 | /// 10 | public static class BuilderExtensions 11 | { 12 | /// 13 | /// 使用数据。 14 | /// 15 | /// 内核建设者。 16 | public static void UseDataBase(this IKernelBuilder kernelBuilder) 17 | { 18 | // kernelBuilder.RegisterExtension(typeof (BuilderExtensions).Assembly); 19 | kernelBuilder.OnStarting( 20 | builder => 21 | { 22 | builder.RegisterType().As().InstancePerDependency(); 23 | builder.RegisterType().As().SingleInstance(); 24 | }); 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security/IAuthenticationService.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | 3 | namespace Rabbit.Components.Security 4 | { 5 | /// 6 | /// 一个抽象的认证服务。 7 | /// 8 | public interface IAuthenticationService : IDependency 9 | { 10 | /// 11 | /// 登录。 12 | /// 13 | /// 用户模型。 14 | /// 是否创建持久的Cookie。 15 | void SignIn(IUser user, bool createPersistentCookie); 16 | 17 | /// 18 | /// 登出。 19 | /// 20 | void SignOut(); 21 | 22 | /// 23 | /// 为当前请求设置一个身份认证。 24 | /// 25 | /// 用户模型。 26 | void SetAuthenticatedUserForRequest(IUser user); 27 | 28 | /// 29 | /// 获取当前认证的用户。 30 | /// 31 | /// 用户模型。 32 | IUser GetAuthenticatedUser(); 33 | } 34 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Mvc/ModelBinders/Impl/DefaultModelBinderPublisher.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Web.Mvc; 3 | 4 | namespace Rabbit.Web.Mvc.Mvc.ModelBinders.Impl 5 | { 6 | internal sealed class DefaultModelBinderPublisher : IModelBinderPublisher 7 | { 8 | private readonly ModelBinderDictionary _binders; 9 | 10 | public DefaultModelBinderPublisher(ModelBinderDictionary binders) 11 | { 12 | _binders = binders; 13 | } 14 | 15 | #region Implementation of IModelBinderPublisher 16 | 17 | /// 18 | /// 发布。 19 | /// 20 | /// 绑定信息。 21 | public void Publish(IEnumerable binders) 22 | { 23 | foreach (var descriptor in binders) 24 | { 25 | _binders[descriptor.Type] = descriptor.ModelBinder; 26 | } 27 | } 28 | 29 | #endregion Implementation of IModelBinderPublisher 30 | } 31 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/ShellBuilders/Impl/KernelMinimumShellDescriptorProvider.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Environment.Descriptor.Models; 2 | using System.Collections.Generic; 3 | 4 | namespace Rabbit.Kernel.Environment.ShellBuilders.Impl 5 | { 6 | internal sealed class KernelMinimumShellDescriptorProvider : IMinimumShellDescriptorProvider 7 | { 8 | #region Implementation of IMinimumShellDescriptorProvider 9 | 10 | /// 11 | /// 获取外壳描述符。 12 | /// 13 | /// 外壳特性描述符。 14 | public void GetFeatures(ICollection features) 15 | { 16 | var list = new[] 17 | { 18 | new ShellFeature {Name = "Rabbit.Kernel"}, 19 | new ShellFeature {Name = "Settings"} 20 | }; 21 | 22 | foreach (var feature in list) 23 | features.Add(feature); 24 | } 25 | 26 | #endregion Implementation of IMinimumShellDescriptorProvider 27 | } 28 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Exceptions/ExceptionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Security; 4 | using System.Threading; 5 | 6 | namespace Rabbit.Kernel.Exceptions 7 | { 8 | /// 9 | /// 异常扩展方法。 10 | /// 11 | public static class ExceptionExtensions 12 | { 13 | /// 14 | /// 是否是一个致命的异常。 15 | /// 16 | /// 异常信息。 17 | /// 如果是致命异常则返回true,否则返回false。 18 | public static bool IsFatal(this Exception exception) 19 | { 20 | return exception is StackOverflowException || 21 | exception is OutOfMemoryException || 22 | exception is AccessViolationException || 23 | exception is AppDomainUnloadedException || 24 | exception is ThreadAbortException || 25 | exception is SecurityException || 26 | exception is SEHException; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/FileSystems/Dependencies/IDependenciesFolder.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Caching; 2 | using System.Collections.Generic; 3 | 4 | namespace Rabbit.Kernel.FileSystems.Dependencies 5 | { 6 | /// 7 | /// 一个抽象的依赖项文件夹。 8 | /// 9 | public interface IDependenciesFolder : IVolatileProvider 10 | { 11 | /// 12 | /// 获取一个依赖项描述符。 13 | /// 14 | /// 模块名称。 15 | /// 依赖项描述符。 16 | DependencyDescriptor GetDescriptor(string moduleName); 17 | 18 | /// 19 | /// 装载所有依赖项描述符。 20 | /// 21 | /// 依赖项描述符集合。 22 | IEnumerable LoadDescriptors(); 23 | 24 | /// 25 | /// 存储依赖项描述符。 26 | /// 27 | /// 依赖项描述符集合。 28 | void StoreDescriptors(IEnumerable dependencyDescriptors); 29 | } 30 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Settings/ITenant.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Kernel.Settings 4 | { 5 | /// 6 | /// 通过接口模式提供租户设置模型。 7 | /// 8 | public interface ITenant 9 | { 10 | /// 11 | /// 租户名称。 12 | /// 13 | string TenantName { get; } 14 | 15 | /// 16 | /// 超级用户。 17 | /// 18 | string SuperUser { get; } 19 | 20 | /// 21 | /// 租户文化。 22 | /// 23 | string TenantCulture { get; set; } 24 | 25 | /// 26 | /// 租户时区。 27 | /// 28 | string TenantTimeZone { get; } 29 | 30 | /// 31 | /// 根据Key获取自定义参数。 32 | /// 33 | /// 参数Key。 34 | /// 参数值。 35 | /// 参数 为空。 36 | object this[string key] { get; set; } 37 | } 38 | } -------------------------------------------------------------------------------- /Rabbit.Web/Works/WebWorkContextModule.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Rabbit.Kernel.Works; 3 | using Rabbit.Web.Works.Impl; 4 | 5 | namespace Rabbit.Web.Works 6 | { 7 | internal sealed class WebWorkContextModule : Module 8 | { 9 | #region Overrides of Module 10 | 11 | /// 12 | /// Override to add registrations to the container. 13 | /// 14 | /// 15 | /// Note that the ContainerBuilder parameter is unique to this module. 16 | /// 17 | /// The builder through which components can be 18 | /// registered. 19 | protected override void Load(ContainerBuilder builder) 20 | { 21 | builder.RegisterType() 22 | .As() 23 | .As() 24 | .InstancePerMatchingLifetimeScope("shell"); 25 | } 26 | 27 | #endregion Overrides of Module 28 | } 29 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security/WorkContentExtensions.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Works; 2 | 3 | namespace Rabbit.Components.Security 4 | { 5 | /// 6 | /// 工作上下文扩展方法。 7 | /// 8 | public static class WorkContentExtensions 9 | { 10 | /// 11 | /// 获取当前用户。 12 | /// 13 | /// 工作上下文。 14 | /// 用户实例。 15 | public static IUser GetCurrentUser(this WorkContext workContext) 16 | { 17 | return workContext.GetCurrentUser(); 18 | } 19 | 20 | /// 21 | /// 获取当前用户。 22 | /// 23 | /// 用户模型类型。 24 | /// 工作上下文。 25 | /// 用户实例。 26 | public static T GetCurrentUser(this WorkContext workContext) where T : IUser 27 | { 28 | return workContext.GetState("CurrentUser"); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Rabbit.Web/WebModule.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Rabbit.Web.Impl; 3 | using Rabbit.Web.Routes; 4 | using Rabbit.Web.Works; 5 | 6 | namespace Rabbit.Web 7 | { 8 | internal sealed class WebModule : Module 9 | { 10 | #region Overrides of Module 11 | 12 | /// 13 | /// Override to add registrations to the container. 14 | /// 15 | /// 16 | /// Note that the ContainerBuilder parameter is unique to this module. 17 | /// 18 | /// The builder through which components can be 19 | /// registered. 20 | protected override void Load(ContainerBuilder builder) 21 | { 22 | builder.RegisterModule(); 23 | builder.RegisterType().As().SingleInstance(); 24 | 25 | builder.RegisterType().InstancePerDependency(); 26 | } 27 | 28 | #endregion Overrides of Module 29 | } 30 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.MySql/MySqlDataServicesProvider.cs: -------------------------------------------------------------------------------- 1 | using MySql.Data.MySqlClient; 2 | using Rabbit.Components.Data.Providers; 3 | using System.Data.Common; 4 | 5 | namespace Rabbit.Components.Data.MySql 6 | { 7 | /// 8 | /// MySql数据服务提供程序。 9 | /// 10 | public class MySqlDataServicesProvider : IDataServicesProvider 11 | { 12 | #region Implementation of IDataServicesProvider 13 | 14 | /// 创建一个数据库连接。 15 | /// 连接字符串。 16 | /// 数据库连接。 17 | public DbConnection CreateConnection(string connectionString) 18 | { 19 | return new MySqlConnection(connectionString); 20 | } 21 | 22 | /// 提供程序名称。 23 | public string ProviderName => "MySql"; 24 | 25 | /// 提供程序不变的名称。 26 | public string ProviderInvariantName => "MySql.Data.MySqlClient"; 27 | 28 | #endregion Implementation of IDataServicesProvider 29 | } 30 | } -------------------------------------------------------------------------------- /Rabbit.Web/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Web")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Web")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("f2b5889c-d87d-471a-a942-93a0602075f1")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.2.0.0")] 35 | [assembly: AssemblyFileVersion("1.2.1.0")] -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/DisplayManagement/Descriptors/ShapeAttributeStrategy/ShapeAttributeOccurrence.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Core; 2 | using Rabbit.Kernel.Extensions.Models; 3 | using System; 4 | using System.Reflection; 5 | 6 | namespace Rabbit.Web.Mvc.DisplayManagement.Descriptors.ShapeAttributeStrategy 7 | { 8 | internal sealed class ShapeAttributeOccurrence 9 | { 10 | private readonly Func _feature; 11 | 12 | public ShapeAttributeOccurrence(ShapeAttribute shapeAttribute, MethodInfo methodInfo, IComponentRegistration registration, Func feature) 13 | { 14 | ShapeAttribute = shapeAttribute; 15 | MethodInfo = methodInfo; 16 | Registration = registration; 17 | _feature = feature; 18 | } 19 | 20 | public ShapeAttribute ShapeAttribute { get; private set; } 21 | 22 | public MethodInfo MethodInfo { get; private set; } 23 | 24 | public IComponentRegistration Registration { get; private set; } 25 | 26 | public Feature Feature { get { return _feature(); } } 27 | } 28 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/Conventions/NotMappedTypeAttributeConvention.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Components.Data.DataAnnotations; 2 | using System; 3 | using System.Data.Entity.ModelConfiguration.Configuration; 4 | using System.Data.Entity.ModelConfiguration.Conventions; 5 | 6 | namespace Rabbit.Components.Data.EntityFramework.Conventions 7 | { 8 | internal sealed class NotMappedTypeAttributeConvention : TypeAttributeConfigurationConvention 9 | { 10 | #region Overrides of TypeAttributeConfigurationConvention 11 | 12 | public override void Apply(ConventionTypeConfiguration configuration, NotMappedAttribute attribute) 13 | { 14 | if (configuration == null) 15 | throw new ArgumentNullException("configuration"); 16 | if (attribute == null) 17 | throw new ArgumentNullException("attribute"); 18 | configuration.Ignore(); 19 | } 20 | 21 | #endregion Overrides of TypeAttributeConfigurationConvention 22 | } 23 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Kernel")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Kernel")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("264b02d5-ad32-469d-8ccc-e330fe4794ea")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.2.0.0")] 35 | [assembly: AssemblyFileVersion("1.2.2.0")] -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/IHost.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Environment.Configuration; 2 | using Rabbit.Kernel.Environment.ShellBuilders; 3 | using Rabbit.Kernel.Works; 4 | 5 | namespace Rabbit.Kernel.Environment 6 | { 7 | /// 8 | /// 一个抽象的主机。 9 | /// 10 | public interface IHost 11 | { 12 | /// 13 | /// 初始化。 14 | /// 15 | void Initialize(); 16 | 17 | /// 18 | /// 重新加载扩展。 19 | /// 20 | void ReloadExtensions(); 21 | 22 | /// 23 | /// 获取一个外壳上下文。 24 | /// 25 | /// 外壳设置。 26 | /// 外壳上下文。 27 | ShellContext GetShellContext(ShellSettings shellSettings); 28 | 29 | /// 30 | /// 创建一个独立的环境。 31 | /// 32 | /// 外壳设置。 33 | /// 工作上下文范围。 34 | IWorkContextScope CreateStandaloneEnvironment(ShellSettings shellSettings); 35 | } 36 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Web.Mvc")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Web.Mvc")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("b116e33d-69a1-47a0-a6c3-811e6d82b77b")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.2.0.0")] 35 | [assembly: AssemblyFileVersion("1.2.0.0")] -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Utility/Extensions/WorkContextExtensions.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Works; 2 | using Rabbit.Web.Works; 3 | using System.Web.Mvc; 4 | 5 | namespace Rabbit.Web.Mvc.Utility.Extensions 6 | { 7 | /// 8 | /// 工作上下文扩展方法。 9 | /// 10 | public static class WorkContextExtensions 11 | { 12 | /// 13 | /// 获取布局。 14 | /// 15 | /// 工作上下文。 16 | /// 布局对象。 17 | public static dynamic GetLayout(this WorkContext workContext) 18 | { 19 | return workContext.GetState("Layout"); 20 | } 21 | 22 | /// 23 | /// 获取工作上下文。 24 | /// 25 | /// 控制器上下文。 26 | /// 工作上下文。 27 | public static WorkContext GetWorkContext(this ControllerContext controllerContext) 28 | { 29 | return controllerContext == null ? null : controllerContext.RequestContext.GetWorkContext(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Logging.NLog/LogUtilities.cs: -------------------------------------------------------------------------------- 1 | using NLog; 2 | 3 | namespace Rabbit.Components.Logging.NLog 4 | { 5 | internal static class LogUtilities 6 | { 7 | public static LogLevel ConvertLogLevel(Kernel.Logging.LogLevel logLevel) 8 | { 9 | switch (logLevel) 10 | { 11 | case Kernel.Logging.LogLevel.Debug: 12 | return LogLevel.Debug; 13 | 14 | case Kernel.Logging.LogLevel.Error: 15 | return LogLevel.Error; 16 | 17 | case Kernel.Logging.LogLevel.Fatal: 18 | return LogLevel.Fatal; 19 | 20 | case Kernel.Logging.LogLevel.Information: 21 | return LogLevel.Info; 22 | 23 | case Kernel.Logging.LogLevel.Trace: 24 | return LogLevel.Trace; 25 | 26 | case Kernel.Logging.LogLevel.Warning: 27 | return LogLevel.Warn; 28 | 29 | default: 30 | return LogLevel.Off; 31 | } 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/Conventions/ComplexTypeAttributeConvention.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Components.Data.DataAnnotations; 2 | using System; 3 | using System.Data.Entity.ModelConfiguration.Configuration; 4 | using System.Data.Entity.ModelConfiguration.Conventions; 5 | 6 | namespace Rabbit.Components.Data.EntityFramework.Conventions 7 | { 8 | internal sealed class ComplexTypeAttributeConvention : TypeAttributeConfigurationConvention 9 | { 10 | #region Overrides of TypeAttributeConfigurationConvention 11 | 12 | public override void Apply(ConventionTypeConfiguration configuration, ComplexTypeAttribute attribute) 13 | { 14 | if (configuration == null) 15 | throw new ArgumentNullException("configuration"); 16 | if (attribute == null) 17 | throw new ArgumentNullException("attribute"); 18 | 19 | configuration.IsComplexType(); 20 | } 21 | 22 | #endregion Overrides of TypeAttributeConfigurationConvention 23 | } 24 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/ShellBuilders/ShellContext.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Rabbit.Kernel.Environment.Configuration; 3 | using Rabbit.Kernel.Environment.Descriptor.Models; 4 | using Rabbit.Kernel.Environment.ShellBuilders.Models; 5 | 6 | namespace Rabbit.Kernel.Environment.ShellBuilders 7 | { 8 | /// 9 | /// 外壳上下文。 10 | /// 11 | public sealed class ShellContext 12 | { 13 | /// 14 | /// 外壳设置。 15 | /// 16 | public ShellSettings Settings { get; set; } 17 | 18 | /// 19 | /// 外壳描述符。 20 | /// 21 | public ShellDescriptor Descriptor { get; set; } 22 | 23 | /// 24 | /// 外壳蓝图。 25 | /// 26 | public ShellBlueprint Blueprint { get; set; } 27 | 28 | /// 29 | /// 外壳容器。 30 | /// 31 | public ILifetimeScope Container { get; set; } 32 | 33 | /// 34 | /// 外壳。 35 | /// 36 | public IShell Shell { get; set; } 37 | } 38 | } -------------------------------------------------------------------------------- /Tests/Rabbit.Kernel.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下特性集 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Kernel.Tests")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Kernel.Tests")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 会使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 请将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("f928c306-b6e5-4234-b3c4-1a6fa2dee85c")] 23 | 24 | // 程序集的版本信息由以下四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/DisplayManagement/Shapes/Impl/DefaultTagBuilderFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace Rabbit.Web.Mvc.DisplayManagement.Shapes.Impl 4 | { 5 | internal sealed class DefaultTagBuilderFactory : ITagBuilderFactory 6 | { 7 | #region Implementation of ITagBuilderFactory 8 | 9 | /// 10 | /// 创建标签建造器。 11 | /// 12 | /// 形状。 13 | /// 标签名称。 14 | /// 标签建造器。 15 | public RabbitTagBuilder Create(dynamic shape, string tagName) 16 | { 17 | var tagBuilder = new RabbitTagBuilder(tagName); 18 | tagBuilder.MergeAttributes(shape.Attributes, false); 19 | foreach (var cssClass in shape.Classes ?? Enumerable.Empty()) 20 | tagBuilder.AddCssClass(cssClass); 21 | if (!string.IsNullOrEmpty(shape.Id)) 22 | tagBuilder.GenerateId(shape.Id); 23 | return tagBuilder; 24 | } 25 | 26 | #endregion Implementation of ITagBuilderFactory 27 | } 28 | } -------------------------------------------------------------------------------- /Rabbit.Web.WarmupStarter/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Web.WarmupStarter")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Web.WarmupStarter")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("ca8615d5-def5-4ad8-ae7c-4879137c4f3c")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.2.0.0")] 35 | [assembly: AssemblyFileVersion("1.2.0.0")] -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.Data")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.Data")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("6f57adcd-3141-41db-8f11-2aec7b4a7fdf")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.3.0.0")] 35 | [assembly: AssemblyFileVersion("1.3.0.0")] -------------------------------------------------------------------------------- /Components/Rabbit.Components.Logging.NLog/LoggerFactory.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Logging; 2 | using System; 3 | 4 | namespace Rabbit.Components.Logging.NLog 5 | { 6 | internal sealed class LoggerFactory : ILoggerFactory 7 | { 8 | #region Field 9 | 10 | private readonly ILoggingConfigurationResolve _loggingConfigurationResolve; 11 | 12 | #endregion Field 13 | 14 | #region Constructor 15 | 16 | public LoggerFactory(ILoggingConfigurationResolve loggingConfigurationResolve) 17 | { 18 | _loggingConfigurationResolve = loggingConfigurationResolve; 19 | } 20 | 21 | #endregion Constructor 22 | 23 | #region Implementation of ILoggerFactory 24 | 25 | /// 26 | /// 创建日志记录器。 27 | /// 28 | /// 类型。 29 | /// 日志记录器实例。 30 | public ILogger CreateLogger(Type type) 31 | { 32 | return new NLogLogger(type, _loggingConfigurationResolve); 33 | } 34 | 35 | #endregion Implementation of ILoggerFactory 36 | } 37 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Utility/Extensions/DefaultExtensionTypes.cs: -------------------------------------------------------------------------------- 1 | namespace Rabbit.Web.Mvc.Utility.Extensions 2 | { 3 | /// 4 | /// 默认扩展类型。 5 | /// 6 | public static class DefaultExtensionTypes 7 | { 8 | /// 9 | /// 主题扩展类型。 10 | /// 11 | public const string Theme = "Theme"; 12 | 13 | /// 14 | /// 模块扩展类型。 15 | /// 16 | public const string Module = "Module"; 17 | 18 | /// 19 | /// 是否是一个主题。 20 | /// 21 | /// 扩展类型。 22 | /// 如果是返回true,否则返回false。 23 | public static bool IsTheme(string type) 24 | { 25 | return type == Theme; 26 | } 27 | 28 | /// 29 | /// 是否是一个模块。 30 | /// 31 | /// 扩展类型。 32 | /// 如果是返回true,否则返回false。 33 | public static bool IsModule(string type) 34 | { 35 | return type == Module; 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /Rabbit.Web/Themes/Impl/TenantThemeSelector.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Environment.Configuration; 2 | using System.Web.Routing; 3 | 4 | namespace Rabbit.Web.Themes.Impl 5 | { 6 | internal sealed class TenantThemeSelector : IThemeSelector 7 | { 8 | #region Field 9 | 10 | private readonly ShellSettings _settings; 11 | 12 | #endregion Field 13 | 14 | #region Constructor 15 | 16 | public TenantThemeSelector(ShellSettings settings) 17 | { 18 | _settings = settings; 19 | } 20 | 21 | #endregion Constructor 22 | 23 | #region Implementation of IThemeSelector 24 | 25 | /// 26 | /// 根据当前请求获取主题。 27 | /// 28 | /// 请求上下文。 29 | /// 主题选择结果。 30 | public ThemeSelectorResult GetTheme(RequestContext context) 31 | { 32 | return new ThemeSelectorResult { Priority = -5, ThemeName = string.Format("{0}_TheThemeMachine", _settings.Name) }; 33 | } 34 | 35 | #endregion Implementation of IThemeSelector 36 | } 37 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Logging.NLog/LoggingBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Rabbit.Kernel; 3 | using Rabbit.Kernel.Environment.ShellBuilders; 4 | using Rabbit.Kernel.Logging; 5 | 6 | namespace Rabbit.Components.Logging.NLog 7 | { 8 | /// 9 | /// 日志建设者扩展方法。 10 | /// 11 | public static class LoggingBuilderExtensions 12 | { 13 | /// 14 | /// 使用NLog。 15 | /// 16 | /// 日志建设者。 17 | public static void UseNLog(this BuilderExtensions.ILoggingBuilder loggingBuilder) 18 | { 19 | loggingBuilder.KernelBuilder 20 | .RegisterExtension(typeof(LoggingBuilderExtensions).Assembly) 21 | .OnStarting(builder => 22 | { 23 | builder.RegisterType() 24 | .As() 25 | .SingleInstance(); 26 | builder.RegisterModule(); 27 | }); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/Assemblies/Impl/AppDomainAssemblyNameResolver.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace Rabbit.Kernel.Environment.Assemblies.Impl 5 | { 6 | internal sealed class AppDomainAssemblyNameResolver : IAssemblyNameResolver 7 | { 8 | #region Implementation of IAssemblyNameResolver 9 | 10 | /// 11 | /// 排序。 12 | /// 13 | public int Order { get { return 10; } } 14 | 15 | /// 16 | /// 解析一个程序集短名称到一个完全名称。 17 | /// 18 | /// 程序集短名称。 19 | /// 程序集完全名称。 20 | public string Resolve(string shortName) 21 | { 22 | return AppDomain.CurrentDomain 23 | .GetAssemblies() 24 | .Where(a => StringComparer.OrdinalIgnoreCase.Equals(shortName, AssemblyLoaderExtensions.ExtractAssemblyShortName(a.FullName))) 25 | .Select(a => a.FullName) 26 | .SingleOrDefault(); 27 | } 28 | 29 | #endregion Implementation of IAssemblyNameResolver 30 | } 31 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Command/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.Command")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.Command")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("f8f0f028-6922-4a15-b9ed-e147f88461d2")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.2.0.0")] 35 | [assembly: AssemblyFileVersion("1.2.0.0")] -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/Conventions/InversePropertyAttributeConvention.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Components.Data.DataAnnotations; 2 | using System.Data.Entity.ModelConfiguration.Configuration; 3 | using System.Data.Entity.ModelConfiguration.Conventions; 4 | using System.Reflection; 5 | 6 | namespace Rabbit.Components.Data.EntityFramework.Conventions 7 | { 8 | internal sealed class InversePropertyAttributeConvention : PropertyAttributeConfigurationConvention 9 | { 10 | #region Overrides of PropertyAttributeConfigurationConvention 11 | 12 | public override void Apply(PropertyInfo memberInfo, ConventionTypeConfiguration configuration, InversePropertyAttribute attribute) 13 | { 14 | new System.Data.Entity.ModelConfiguration.Conventions.InversePropertyAttributeConvention().Apply(memberInfo, configuration, new System.ComponentModel.DataAnnotations.Schema.InversePropertyAttribute(attribute.Property)); 15 | } 16 | 17 | #endregion Overrides of PropertyAttributeConfigurationConvention 18 | } 19 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.Mvc/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.Data.Mvc")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.Data.Mvc")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("fd307fc3-41a7-4580-9eac-596e08cb5797")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.2.0.0")] 35 | [assembly: AssemblyFileVersion("1.2.0.0")] -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.MySql/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.Data.MySql")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.Data.MySql")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("0417df87-e392-474f-9014-7a4b16997061")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /Components/Rabbit.Components.DataBase/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.DataBase")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.DataBase")] 12 | [assembly: AssemblyCopyright("Copyright © 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("dc0f6173-9aaf-4f41-8c22-b18cb6fdf97a")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.Security")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.Security")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("cc19cadc-27e4-41a8-bdbe-a6a23f081689")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.2.0.0")] 35 | [assembly: AssemblyFileVersion("1.2.0.0")] -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security/Permissions/Permission.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Rabbit.Components.Security.Permissions 4 | { 5 | /// 6 | /// 一个许可模型。 7 | /// 8 | public class Permission 9 | { 10 | /// 11 | /// 许可名称。 12 | /// 13 | public string Name { get; set; } 14 | 15 | /// 16 | /// 许可说明。 17 | /// 18 | public string Description { get; set; } 19 | 20 | /// 21 | /// 许可分类。 22 | /// 23 | public string Category { get; set; } 24 | 25 | /// 26 | /// 隐示通过的许可。 27 | /// 28 | public IEnumerable ImpliedBy { get; set; } 29 | 30 | /// 31 | /// 通过名称来新建一个许可。 32 | /// 33 | /// 许可名称。 34 | /// 许可模型。 35 | 36 | public static Permission Named(string name) 37 | { 38 | return new Permission { Name = name }; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Bus.SignalR/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.Bus.SignalR")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.Bus.SignalR")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("2aa09c7c-e57c-4cb4-9bdb-114a646eea5c")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.2.0.0")] 35 | [assembly: AssemblyFileVersion("1.2.0.0")] -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/Conventions/ForeignKeyPrimitivePropertyAttributeConvention.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Components.Data.DataAnnotations; 2 | using System.Data.Entity.ModelConfiguration.Configuration; 3 | using System.Data.Entity.ModelConfiguration.Conventions; 4 | using System.Reflection; 5 | 6 | namespace Rabbit.Components.Data.EntityFramework.Conventions 7 | { 8 | internal sealed class ForeignKeyPrimitivePropertyAttributeConvention : PropertyAttributeConfigurationConvention 9 | { 10 | #region Overrides of PropertyAttributeConfigurationConvention 11 | 12 | public override void Apply(PropertyInfo memberInfo, ConventionTypeConfiguration configuration, ForeignKeyAttribute attribute) 13 | { 14 | new System.Data.Entity.ModelConfiguration.Conventions.ForeignKeyPrimitivePropertyAttributeConvention().Apply(memberInfo, configuration, new System.ComponentModel.DataAnnotations.Schema.ForeignKeyAttribute(attribute.Name)); 15 | } 16 | 17 | #endregion Overrides of PropertyAttributeConfigurationConvention 18 | } 19 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Web.SignalR/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.Web.SignalR")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.Web.SignalR")] 12 | [assembly: AssemblyCopyright("Copyright © 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("c30df7b5-1ee5-480e-b9a0-dbb2272eb45d")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.2.0.0")] 35 | [assembly: AssemblyFileVersion("1.2.0.0")] -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.Migrators/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.Data.Migrators")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.Data.Migrators")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("595f93f7-4028-4640-85b1-814d4f6f51f9")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.2.0.0")] 35 | [assembly: AssemblyFileVersion("1.2.3")] -------------------------------------------------------------------------------- /Components/Rabbit.Components.Logging.NLog/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.Logging.NLog")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.Logging.NLog")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("92b103d2-a8c7-4ed3-8771-7393db1b8b37")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.2.0.0")] 35 | [assembly: AssemblyFileVersion("1.2.0.0")] -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security.Web/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.Security.Web")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.Security.Web")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("65b203e4-3715-4812-ad25-f8ecd9e6d2c0")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.2.0.0")] 35 | [assembly: AssemblyFileVersion("1.2.0.1")] -------------------------------------------------------------------------------- /Components/Rabbit.Components.DataBase.MySql/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.DataBase.MySql")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.DataBase.MySql")] 12 | [assembly: AssemblyCopyright("Copyright © 2015")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("2a2b5d96-a371-4d59-9aaf-89fd8d10ee49")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/UI/Zones/LayoutWorkContext.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Works; 2 | using Rabbit.Web.Mvc.DisplayManagement; 3 | using System; 4 | 5 | namespace Rabbit.Web.Mvc.UI.Zones 6 | { 7 | internal sealed class LayoutWorkContext : IWorkContextStateProvider 8 | { 9 | private readonly IShapeFactory _shapeFactory; 10 | 11 | public LayoutWorkContext(IShapeFactory shapeFactory) 12 | { 13 | _shapeFactory = shapeFactory; 14 | } 15 | 16 | #region Implementation of IWorkContextStateProvider 17 | 18 | /// 19 | /// 创建一个从一个工作上下文获取服务的委托。 20 | /// 21 | /// 服务类型。 22 | /// 服务名称。 23 | /// 从一个工作上下文获取服务的委托。 24 | public Func Get(string name) 25 | { 26 | if (name != "Layout") 27 | return null; 28 | var layout = _shapeFactory.Create("Layout", Arguments.Empty()); 29 | return ctx => (T)layout; 30 | } 31 | 32 | #endregion Implementation of IWorkContextStateProvider 33 | } 34 | } -------------------------------------------------------------------------------- /Tests/Rabbit.Kernel.Tests/Caching/CacheManagerTests.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Microsoft.VisualStudio.TestTools.UnitTesting; 3 | using Rabbit.Kernel.Caching; 4 | using System; 5 | 6 | namespace Rabbit.Kernel.Tests.Caching 7 | { 8 | [TestClass] 9 | public sealed class CacheManagerTests : TestBase 10 | { 11 | private readonly ICacheManager _cacheManager; 12 | 13 | public CacheManagerTests() 14 | { 15 | _cacheManager = LifetimeScope.Resolve(new TypedParameter(typeof(Type), typeof(CacheManagerTests))); 16 | } 17 | 18 | public ILifetimeScope LifetimeScope { get; set; } 19 | 20 | [TestMethod] 21 | public void CacheTest() 22 | { 23 | var count = 0; 24 | var result = _cacheManager.Get("Test", ctx => count = count + 1); 25 | Assert.AreEqual(1, result); 26 | result = _cacheManager.Get("Test", ctx => count = count + 1); 27 | Assert.AreEqual(1, result); 28 | 29 | result = _cacheManager.Get("Test1", ctx => count = count + 1); 30 | Assert.AreEqual(2, result); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Logging.NLog.Web/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.Logging.NLog.Web")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.Logging.NLog.Web")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("b0e6ce10-40e1-49e1-af1d-472bf56e036e")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.2.0.0")] 35 | [assembly: AssemblyFileVersion("1.2.0.0")] -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的常规信息通过以下 5 | // 特性集控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.Data.EntityFramework")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.Data.EntityFramework")] 12 | [assembly: AssemblyCopyright("Copyright © 2014")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | // 将 ComVisible 设置为 false 使此程序集中的类型 17 | // 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | // 则将该类型上的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("c953897e-5572-4bc4-9a07-a5ae3b0c43e4")] 23 | 24 | // 程序集的版本信息由下面四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.2.0.0")] 35 | [assembly: AssemblyFileVersion("1.2.0.1")] -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.Migrators.MySql/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.Data.Migrators.MySql")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.Data.Migrators.MySql")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("7046a10c-5b65-4d92-b651-e966064d4d6e")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data/Providers/SqlServerDataServicesProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Common; 2 | using System.Data.SqlClient; 3 | 4 | namespace Rabbit.Components.Data.Providers 5 | { 6 | /// 7 | /// SQLServer数据服务提供程序。 8 | /// 9 | public class SqlServerDataServicesProvider : IDataServicesProvider 10 | { 11 | #region Implementation of IDataServicesProvider 12 | 13 | /// 14 | /// 提供程序名称。 15 | /// 16 | public string ProviderName { get { return "SqlServer"; } } 17 | 18 | /// 19 | /// 提供程序不变的名称。 20 | /// 21 | public string ProviderInvariantName { get { return "System.Data.SqlClient"; } } 22 | 23 | /// 24 | /// 创建一个数据库连接。 25 | /// 26 | /// 连接字符串。 27 | /// 数据库连接。 28 | public DbConnection CreateConnection(string connectionString) 29 | { 30 | return new SqlConnection(connectionString); 31 | } 32 | 33 | #endregion Implementation of IDataServicesProvider 34 | } 35 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Caching/Impl/DefaultCacheManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Kernel.Caching.Impl 4 | { 5 | internal sealed class DefaultCacheManager : ICacheManager 6 | { 7 | #region Field 8 | 9 | private readonly Type _component; 10 | private readonly ICacheHolder _cacheHolder; 11 | 12 | #endregion Field 13 | 14 | #region Constructor 15 | 16 | public DefaultCacheManager(Type component, ICacheHolder cacheHolder) 17 | { 18 | _component = component; 19 | _cacheHolder = cacheHolder; 20 | } 21 | 22 | #endregion Constructor 23 | 24 | #region Implementation of ICacheManager 25 | 26 | /// 27 | /// 获取一个缓存实例。 28 | /// 29 | /// 键类型。 30 | /// 结果类型。 31 | /// 缓存实例。 32 | public ICache GetCache() 33 | { 34 | return _cacheHolder.GetCache(_component); 35 | } 36 | 37 | #endregion Implementation of ICacheManager 38 | } 39 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Web.SignalR/ConnectionAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Components.Web.SignalR 4 | { 5 | /// 6 | /// 允许自定义连接名称和URL。 7 | /// 8 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 9 | public class ConnectionAttribute : Attribute 10 | { 11 | #region Constructor 12 | 13 | public ConnectionAttribute(string name) 14 | : this(name, string.Empty) 15 | { 16 | } 17 | 18 | public ConnectionAttribute(string name, string url) 19 | { 20 | if (string.IsNullOrWhiteSpace(name)) 21 | throw new ArgumentException("连接名称不能为空。", "name"); 22 | 23 | Name = name; 24 | Url = url; 25 | } 26 | 27 | #endregion Constructor 28 | 29 | #region Property 30 | 31 | /// 32 | /// 连接名称。 33 | /// 34 | public string Name { get; set; } 35 | 36 | /// 37 | /// 连接URL。 38 | /// 39 | public string Url { get; set; } 40 | 41 | #endregion Property 42 | } 43 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Settings/Impl/DefaultTenantService.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Caching; 2 | using Rabbit.Kernel.Environment.Configuration; 3 | 4 | namespace Rabbit.Kernel.Settings.Impl 5 | { 6 | internal sealed class DefaultTenantService : ITenantService 7 | { 8 | #region Field 9 | 10 | private readonly ShellSettings _shellSettings; 11 | private readonly ICacheManager _cacheManager; 12 | 13 | #endregion Field 14 | 15 | #region Constructor 16 | 17 | public DefaultTenantService(ShellSettings shellSettings, ICacheManager cacheManager) 18 | { 19 | _shellSettings = shellSettings; 20 | _cacheManager = cacheManager; 21 | } 22 | 23 | #endregion Constructor 24 | 25 | #region Implementation of ITenantService 26 | 27 | /// 28 | /// 获取当前租户设置。 29 | /// 30 | /// 当前租户设置实例。 31 | public ITenant GetTenantSettings() 32 | { 33 | return _cacheManager.Get("Site", ctx => new DefaultTenant(_shellSettings.Name)); 34 | } 35 | 36 | #endregion Implementation of ITenantService 37 | } 38 | } -------------------------------------------------------------------------------- /Tests/Rabbit.Kernel.Tests/Environment/BuildManagerTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | using Rabbit.Kernel.Environment; 3 | using System; 4 | using System.Linq; 5 | 6 | namespace Rabbit.Kernel.Tests.Environment 7 | { 8 | [TestClass] 9 | public sealed class BuildManagerTests : TestBase 10 | { 11 | public IBuildManager BuildManager { get; set; } 12 | 13 | [TestMethod] 14 | public void GetReferencedAssembliesTest() 15 | { 16 | Assert.IsTrue(BuildManager.GetReferencedAssemblies().Any()); 17 | } 18 | 19 | [TestMethod] 20 | public void HasReferencedAssemblyTest() 21 | { 22 | Assert.IsTrue(BuildManager.HasReferencedAssembly("Rabbit.Kernel")); 23 | Assert.IsFalse(BuildManager.HasReferencedAssembly(Guid.NewGuid().ToString("n"))); 24 | } 25 | 26 | [TestMethod] 27 | public void GetReferencedAssemblyTest() 28 | { 29 | Assert.IsNotNull(BuildManager.GetReferencedAssembly("Rabbit.Kernel")); 30 | Assert.IsNull(BuildManager.GetReferencedAssembly(Guid.NewGuid().ToString("N"))); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework.MySql/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // 有关程序集的一般信息由以下 5 | // 控制。更改这些特性值可修改 6 | // 与程序集关联的信息。 7 | [assembly: AssemblyTitle("Rabbit.Components.Data.EntityFramework.MySql")] 8 | [assembly: AssemblyDescription("")] 9 | [assembly: AssemblyConfiguration("")] 10 | [assembly: AssemblyCompany("")] 11 | [assembly: AssemblyProduct("Rabbit.Components.Data.EntityFramework.MySql")] 12 | [assembly: AssemblyCopyright("Copyright © 2016")] 13 | [assembly: AssemblyTrademark("")] 14 | [assembly: AssemblyCulture("")] 15 | 16 | //将 ComVisible 设置为 false 将使此程序集中的类型 17 | //对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, 18 | //请将此类型的 ComVisible 特性设置为 true。 19 | [assembly: ComVisible(false)] 20 | 21 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 22 | [assembly: Guid("6ba8677d-0261-476d-aff6-17da447b587f")] 23 | 24 | // 程序集的版本信息由下列四个值组成: 25 | // 26 | // 主版本 27 | // 次版本 28 | // 生成号 29 | // 修订号 30 | // 31 | //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 32 | // 方法是按如下所示使用“*”: : 33 | // [assembly: AssemblyVersion("1.0.*")] 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] -------------------------------------------------------------------------------- /Components/Rabbit.Components.Bus.SignalR/BusBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using Autofac; 2 | using Rabbit.Kernel.Bus; 3 | using Rabbit.Kernel.Utility.Extensions; 4 | 5 | namespace Rabbit.Components.Bus.SignalR 6 | { 7 | /// 8 | /// 总线建设者扩展方法。 9 | /// 10 | public static class BusBuilderExtensions 11 | { 12 | /// 13 | /// 主机 Url。 14 | /// 15 | internal static string HostUrl; 16 | 17 | internal static string Path; 18 | 19 | /// 20 | /// 使用 SignalR 总线。 21 | /// 22 | /// 总线建设者。 23 | /// 主机 Url。 24 | /// 路径。 25 | public static void UseSignalR(this BuilderExtensions.IBusBuilder busBuilder, string hostUrl, string path) 26 | { 27 | HostUrl = hostUrl.NotEmptyOrWhiteSpace("hostUrl"); 28 | Path = path.NotEmptyOrWhiteSpace("path"); 29 | 30 | busBuilder.KernelBuilder.OnStarting(builder => builder.RegisterType().As().InstancePerMatchingLifetimeScope("shell")); 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security/IAuthorizationService.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Components.Security.Permissions; 2 | using Rabbit.Kernel; 3 | using System; 4 | 5 | namespace Rabbit.Components.Security 6 | { 7 | /// 8 | /// 一个抽象的授权服务。 9 | /// 10 | public interface IAuthorizationService : IDependency 11 | { 12 | /// 13 | /// 检查访问权限。 14 | /// 15 | /// 需要的许可。 16 | /// 用户模型。 17 | /// 为 null。 18 | /// 检查权限失败。 19 | void CheckAccess(Permission permission, IUser user); 20 | 21 | /// 22 | /// 尝试检查访问权限。 23 | /// 24 | /// 需要的许可。 25 | /// 用户模型。 26 | /// 如果可以访问则返回true,否则返回false。 27 | /// 为 null。 28 | bool TryCheckAccess(Permission permission, IUser user); 29 | } 30 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/DisplayManagement/IShapeFactory.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using System; 3 | 4 | namespace Rabbit.Web.Mvc.DisplayManagement 5 | { 6 | /// 7 | /// 一个抽象的形状工厂。 8 | /// 9 | public interface IShapeFactory : IDependency 10 | { 11 | /// 12 | /// 创建形状。 13 | /// 14 | /// 形状类型。 15 | /// 形状实例。 16 | IShape Create(string shapeType); 17 | 18 | /// 19 | /// 创建形状。 20 | /// 21 | /// 形状类型。 22 | /// 参数。 23 | /// 形状实例。 24 | IShape Create(string shapeType, INamedEnumerable parameters); 25 | 26 | /// 27 | /// 创建形状。 28 | /// 29 | /// 形状类型。 30 | /// 参数。 31 | /// 创建形状委托。 32 | /// 形状实例。 33 | IShape Create(string shapeType, INamedEnumerable parameters, Func createShape); 34 | } 35 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security.Web/NavigationItemBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Components.Security.Permissions; 2 | using Rabbit.Kernel.Utility.Extensions; 3 | using Rabbit.Web.UI.Navigation; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | 7 | namespace Rabbit.Components.Security.Web 8 | { 9 | /// 10 | /// 导航项建设者扩展方法。 11 | /// 12 | public static class NavigationItemBuilderExtensions 13 | { 14 | /// 15 | /// 许可。 16 | /// 17 | /// 导航项建设者。 18 | /// 许可模型。 19 | /// 导航项建设者。 20 | public static NavigationItemBuilder Permission(this NavigationItemBuilder builder, params Permission[] permissions) 21 | { 22 | permissions.NotNull("permissions"); 23 | 24 | const string name = "Permissions"; 25 | var permissionList = builder.MenuItem.GetAttribute>(name) ?? Enumerable.Empty(); 26 | builder.MenuItem.SetAttribute(name, permissionList.Concat(permissions)); 27 | 28 | return builder; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Services/IClock.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Caching; 2 | using System; 3 | 4 | namespace Rabbit.Kernel.Services 5 | { 6 | /// 7 | /// 提供UTC时间支持。 8 | /// 9 | public interface IClock : IVolatileProvider 10 | { 11 | /// 12 | /// 从 获取系统当前的Utc时间。 13 | /// 14 | DateTime UtcNow { get; } 15 | 16 | /// 17 | /// 根据绝对Utc时间隔获取一个挥发令牌。 18 | /// 19 | /// 绝对的Utc时间。 20 | /// 挥发令牌实例。 21 | IVolatileToken WhenUtc(DateTime absoluteUtc); 22 | } 23 | 24 | /// 25 | /// 时钟扩展方法。 26 | /// 27 | public static class ClockExtensions 28 | { 29 | /// 30 | /// 根据时间间隔获取一个挥发令牌。 31 | /// 32 | /// 时钟服务。 33 | /// 时间间隔。 34 | /// 挥发令牌实例。 35 | public static IVolatileToken When(this IClock clock, TimeSpan duration) 36 | { 37 | return clock.WhenUtc(clock.UtcNow.Add(duration)); 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Environment/IBuildManager.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Reflection; 3 | 4 | namespace Rabbit.Kernel.Environment 5 | { 6 | /// 7 | /// 一个抽象的生成管理者。 8 | /// 9 | public interface IBuildManager : IDependency 10 | { 11 | /// 12 | /// 获取当前所有引用的程序集。 13 | /// 14 | /// 程序集集合。 15 | IEnumerable GetReferencedAssemblies(); 16 | 17 | /// 18 | /// 是否引用了名称为 的程序集。 19 | /// 20 | /// 程序集名称。 21 | /// 引用了为true,否则为false。 22 | bool HasReferencedAssembly(string name); 23 | 24 | /// 25 | /// 获取引用程序集。 26 | /// 27 | /// 程序集名称。 28 | /// 程序集。 29 | Assembly GetReferencedAssembly(string name); 30 | 31 | /// 32 | /// 获取编译程序集。 33 | /// 34 | /// 虚拟路径。 35 | /// 程序集。 36 | Assembly GetCompiledAssembly(string virtualPath); 37 | } 38 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Extensions/Folders/Impl/ModuleFolders.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Extensions.Models; 2 | using System.Collections.Generic; 3 | 4 | namespace Rabbit.Kernel.Extensions.Folders.Impl 5 | { 6 | internal sealed class ModuleFolders : IExtensionFolders 7 | { 8 | #region Field 9 | 10 | private readonly IEnumerable _paths; 11 | private readonly IExtensionHarvester _extensionHarvester; 12 | 13 | #endregion Field 14 | 15 | #region Constructor 16 | 17 | public ModuleFolders(IEnumerable paths, IExtensionHarvester extensionHarvester) 18 | { 19 | _paths = paths; 20 | _extensionHarvester = extensionHarvester; 21 | } 22 | 23 | #endregion Constructor 24 | 25 | #region Implementation of IExtensionFolders 26 | 27 | /// 28 | /// 可用的扩展。 29 | /// 30 | /// 扩展描述符条目集合。 31 | public IEnumerable AvailableExtensions() 32 | { 33 | return _extensionHarvester.HarvestExtensions(_paths, "Module", "Module.txt", false); 34 | } 35 | 36 | #endregion Implementation of IExtensionFolders 37 | } 38 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/Impl/DefaultDbConfiguration.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Components.Data.EntityFramework.Migrations; 2 | using Rabbit.Web.Works; 3 | using System.Data.Entity; 4 | using System.Web; 5 | 6 | namespace Rabbit.Components.Data.EntityFramework.Impl 7 | { 8 | internal sealed class DefaultDbConfiguration : DbConfiguration 9 | { 10 | public DefaultDbConfiguration() 11 | { 12 | IDatabaseInitializer databaseInitializer; 13 | 14 | if (GlobalConfig.AutomaticMigrationsEnabled) 15 | { 16 | databaseInitializer = new MigrateDatabaseToLatestVersion(); 17 | SetContextFactory(typeof(DefaultDbContext), () => 18 | { 19 | var work = new HttpContextWrapper(HttpContext.Current).Request.RequestContext.GetWorkContext(); 20 | return work.Resolve().Create(); 21 | }); 22 | } 23 | else 24 | databaseInitializer = new NullDatabaseInitializer(); 25 | 26 | SetDatabaseInitializer(databaseInitializer); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Extensions/IFeatureDescriptorFilter.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Extensions.Models; 2 | 3 | namespace Rabbit.Kernel.Extensions 4 | { 5 | /// 6 | /// 特性描述符过滤器上下文。 7 | /// 8 | public sealed class FeatureDescriptorFilterContext 9 | { 10 | /// 11 | /// 初始化一个新的特性描述符过滤器上下文。 12 | /// 13 | /// 特性描述符。 14 | public FeatureDescriptorFilterContext(FeatureDescriptor feature) 15 | { 16 | Feature = feature; 17 | Valid = true; 18 | } 19 | 20 | /// 21 | /// 特性描述符。 22 | /// 23 | public FeatureDescriptor Feature { get; private set; } 24 | 25 | /// 26 | /// 是否可用。 27 | /// 28 | public bool Valid { get; set; } 29 | } 30 | 31 | /// 32 | /// 一个抽象的特性描述符过滤器。 33 | /// 34 | public interface IFeatureDescriptorFilter 35 | { 36 | /// 37 | /// 在发现特性时执行。 38 | /// 39 | /// 特性描述符过滤器上下文。 40 | void OnDiscovery(FeatureDescriptorFilterContext context); 41 | } 42 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/Mvc/Filters/RabbitFilterProvider.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Web.Mvc.Utility.Extensions; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web.Mvc; 5 | 6 | namespace Rabbit.Web.Mvc.Mvc.Filters 7 | { 8 | internal sealed class RabbitFilterProvider : System.Web.Mvc.IFilterProvider 9 | { 10 | #region Implementation of IFilterProvider 11 | 12 | /// 13 | /// 返回一个包含服务定位器中的所有 实例的枚举器。 14 | /// 15 | /// 16 | /// 包含服务定位器中的所有 实例的枚举器。 17 | /// 18 | /// 控制器上下文。操作描述符。 19 | public IEnumerable GetFilters(ControllerContext controllerContext, ActionDescriptor actionDescriptor) 20 | { 21 | var workContext = controllerContext.GetWorkContext(); 22 | var filterProviders = workContext.Resolve>(); 23 | return filterProviders.Select(x => new Filter(x, FilterScope.Action, null)); 24 | } 25 | 26 | #endregion Implementation of IFilterProvider 27 | } 28 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Caching/Weak.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Rabbit.Kernel.Caching 4 | { 5 | /// 6 | /// 弱引用类型持有者。 7 | /// 8 | /// 类型。 9 | public sealed class Weak 10 | { 11 | private readonly WeakReference _target; 12 | 13 | /// 14 | /// 初始化一个弱引用类型持有者。 15 | /// 16 | /// 对象引用的对象(目标)。 17 | public Weak(T target) 18 | { 19 | _target = new WeakReference(target); 20 | } 21 | 22 | /// 23 | /// 初始化一个弱引用类型持有者。 24 | /// 25 | /// 对象引用的对象(目标)。 26 | /// 指示何时停止跟踪对象。 如果为 true,则在终结后跟踪对象;如果为 false,则仅在终结前跟踪对象。 27 | public Weak(T target, bool trackResurrection) 28 | { 29 | _target = new WeakReference(target, trackResurrection); 30 | } 31 | 32 | /// 33 | /// 获取或设置对象引用的对象(目标)。 34 | /// 35 | public T Target 36 | { 37 | get { return (T)_target.Target; } 38 | set { _target.Target = value; } 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/Migrations/Configuration.cs: -------------------------------------------------------------------------------- 1 | using System.Data.Entity.Migrations; 2 | 3 | namespace Rabbit.Components.Data.EntityFramework.Migrations 4 | { 5 | internal sealed class Configuration : DbMigrationsConfiguration 6 | { 7 | public Configuration() 8 | { 9 | AutomaticMigrationsEnabled = true; 10 | AutomaticMigrationDataLossAllowed = true; 11 | ContextKey = "Rabbit.Components.Data.EntityFramework.DefaultDbContext"; 12 | } 13 | 14 | protected override void Seed(DefaultDbContext context) 15 | { 16 | // This method will be called after migrating to the latest version. 17 | 18 | // You can use the DbSet.AddOrUpdate() helper extension method 19 | // to avoid creating duplicate seed data. E.g. 20 | // 21 | // context.People.AddOrUpdate( 22 | // p => p.FullName, 23 | // new Person { FullName = "Andrew Peters" }, 24 | // new Person { FullName = "Brice Lambson" }, 25 | // new Person { FullName = "Rowan Miller" } 26 | // ); 27 | // 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Logging.NLog.Web/UrlLayoutRenderer.cs: -------------------------------------------------------------------------------- 1 | using NLog; 2 | using NLog.LayoutRenderers; 3 | using System.Text; 4 | using System.Web; 5 | 6 | namespace Rabbit.Components.Logging.NLog.Web 7 | { 8 | [LayoutRenderer("url")] 9 | internal sealed class UrlLayoutRenderer : LayoutRenderer 10 | { 11 | #region Overrides of LayoutRenderer 12 | 13 | /// 14 | /// Renders the specified environmental information and appends it to the specified . 15 | /// 16 | /// The to append the rendered data to.Logging event. 17 | protected override void Append(StringBuilder builder, LogEventInfo logEvent) 18 | { 19 | try 20 | { 21 | if (HttpContext.Current == null) 22 | return; 23 | builder.Append("Url:"); 24 | builder.AppendLine(HttpContext.Current.Request.Url.ToString()); 25 | } 26 | catch 27 | { 28 | } 29 | } 30 | 31 | #endregion Overrides of LayoutRenderer 32 | } 33 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data.EntityFramework/Conventions/NotMappedPropertyAttributeConvention.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Components.Data.DataAnnotations; 2 | using System; 3 | using System.Data.Entity.ModelConfiguration.Configuration; 4 | using System.Data.Entity.ModelConfiguration.Conventions; 5 | using System.Reflection; 6 | 7 | namespace Rabbit.Components.Data.EntityFramework.Conventions 8 | { 9 | internal sealed class NotMappedPropertyAttributeConvention : PropertyAttributeConfigurationConvention 10 | { 11 | #region Overrides of PropertyAttributeConfigurationConvention 12 | 13 | public override void Apply(PropertyInfo memberInfo, ConventionTypeConfiguration configuration, NotMappedAttribute attribute) 14 | { 15 | if (memberInfo == null) 16 | throw new ArgumentNullException("memberInfo"); 17 | if (attribute == null) 18 | throw new ArgumentNullException("attribute"); 19 | if (attribute == null) 20 | throw new ArgumentNullException("attribute"); 21 | configuration.Ignore(memberInfo); 22 | } 23 | 24 | #endregion Overrides of PropertyAttributeConfigurationConvention 25 | } 26 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Data/Utility/Extensions/ShellBlueprintExtensions.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Components.Data.Models; 2 | using Rabbit.Kernel.Environment.ShellBuilders.Models; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | 6 | namespace Rabbit.Components.Data.Utility.Extensions 7 | { 8 | /// 9 | /// 外壳蓝图扩展。 10 | /// 11 | public static class ShellBlueprintExtensions 12 | { 13 | /// 14 | /// 获取蓝图里面的记录蓝图。 15 | /// 16 | /// 外壳蓝图。 17 | /// 记录蓝图。 18 | public static IEnumerable GetRecords(this ShellBlueprint shellBlueprint) 19 | { 20 | return shellBlueprint["Records"] as IEnumerable ?? Enumerable.Empty(); 21 | } 22 | 23 | /// 24 | /// 设置外壳蓝图里的记录蓝图。 25 | /// 26 | /// 外壳蓝图。 27 | /// 记录蓝图。 28 | public static void SetRecords(this ShellBlueprint shellBlueprint, IEnumerable records) 29 | { 30 | shellBlueprint["Records"] = records; 31 | } 32 | } 33 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/Settings/Impl/CurrentTenantWorkContext.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Works; 2 | using System; 3 | 4 | namespace Rabbit.Kernel.Settings.Impl 5 | { 6 | internal sealed class CurrentTenantWorkContext : IWorkContextStateProvider 7 | { 8 | #region Field 9 | 10 | private readonly ITenantService _tenantService; 11 | 12 | #endregion Field 13 | 14 | #region Constructor 15 | 16 | public CurrentTenantWorkContext(ITenantService tenantService) 17 | { 18 | _tenantService = tenantService; 19 | } 20 | 21 | #endregion Constructor 22 | 23 | #region Implementation of IWorkContextStateProvider 24 | 25 | /// 26 | /// 创建一个从一个工作上下文获取服务的委托。 27 | /// 28 | /// 服务类型。 29 | /// 服务名称。 30 | /// 从一个工作上下文获取服务的委托。 31 | public Func Get(string name) 32 | { 33 | if (name != "CurrentTenant") return null; 34 | var siteSettings = _tenantService.GetTenantSettings(); 35 | return ctx => (T)siteSettings; 36 | } 37 | 38 | #endregion Implementation of IWorkContextStateProvider 39 | } 40 | } -------------------------------------------------------------------------------- /Rabbit.Web/Impl/HttpContextWorkContext.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Works; 2 | using System; 3 | 4 | namespace Rabbit.Web.Impl 5 | { 6 | internal sealed class HttpContextWorkContext : IWorkContextStateProvider 7 | { 8 | #region Field 9 | 10 | private readonly IHttpContextAccessor _httpContextAccessor; 11 | 12 | #endregion Field 13 | 14 | #region Constructor 15 | 16 | public HttpContextWorkContext(IHttpContextAccessor httpContextAccessor) 17 | { 18 | _httpContextAccessor = httpContextAccessor; 19 | } 20 | 21 | #endregion Constructor 22 | 23 | #region Implementation of IWorkContextStateProvider 24 | 25 | /// 26 | /// 获取状态信值。 27 | /// 28 | /// 状态类型。 29 | /// 状态名称。 30 | /// 获取状态值的委托。 31 | public Func Get(string name) 32 | { 33 | if (name != "HttpContext") 34 | return null; 35 | var result = (T)(object)_httpContextAccessor.Current(); 36 | return ctx => result; 37 | } 38 | 39 | #endregion Implementation of IWorkContextStateProvider 40 | } 41 | } -------------------------------------------------------------------------------- /Rabbit.Web.Mvc/DisplayManagement/Descriptors/Interfaces.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel; 2 | using Rabbit.Kernel.Events; 3 | 4 | namespace Rabbit.Web.Mvc.DisplayManagement.Descriptors 5 | { 6 | /// 7 | /// 一个抽象的形状表格管理者。 8 | /// 9 | public interface IShapeTableManager : ISingletonDependency 10 | { 11 | /// 12 | /// 获取形状表格。 13 | /// 14 | /// 主题名称。 15 | /// 形状表格。 16 | ShapeTable GetShapeTable(string themeName); 17 | } 18 | 19 | /// 20 | /// 一个抽象的形状表格提供程序。 21 | /// 22 | public interface IShapeTableProvider : IDependency 23 | { 24 | /// 25 | /// 发现形状表格。 26 | /// 27 | /// 形状表格建造者。 28 | void Discover(ShapeTableBuilder builder); 29 | } 30 | 31 | /// 32 | /// 一个抽象的形状表格事件处理程序。 33 | /// 34 | public interface IShapeTableEventHandler : IEventHandler 35 | { 36 | /// 37 | /// 形状表格被创建时执行。 38 | /// 39 | /// 形状表格。 40 | void ShapeTableCreated(ShapeTable shapeTable); 41 | } 42 | } -------------------------------------------------------------------------------- /Rabbit.Kernel/CollectionOrderModule.cs: -------------------------------------------------------------------------------- 1 | using Autofac.Core; 2 | using System; 3 | using System.Collections; 4 | 5 | namespace Rabbit.Kernel 6 | { 7 | internal sealed class CollectionOrderModule : IModule 8 | { 9 | #region Implementation of IModule 10 | 11 | /// 12 | /// Apply the module to the component registry. 13 | /// 14 | /// Component registry to apply configuration to. 15 | public void Configure(IComponentRegistry componentRegistry) 16 | { 17 | componentRegistry.Registered += (sender, registered) => 18 | { 19 | var limitType = registered.ComponentRegistration.Activator.LimitType; 20 | if (typeof(IEnumerable).IsAssignableFrom(limitType)) 21 | { 22 | registered.ComponentRegistration.Activated += (sender2, activated) => 23 | { 24 | var array = activated.Instance as Array; 25 | if (array != null) 26 | Array.Reverse(array); 27 | }; 28 | } 29 | }; 30 | } 31 | 32 | #endregion Implementation of IModule 33 | } 34 | } -------------------------------------------------------------------------------- /Components/Rabbit.Components.Security/CurrentUserWorkContext.cs: -------------------------------------------------------------------------------- 1 | using Rabbit.Kernel.Works; 2 | using System; 3 | 4 | namespace Rabbit.Components.Security 5 | { 6 | internal sealed class CurrentUserWorkContext : IWorkContextStateProvider 7 | { 8 | #region Field 9 | 10 | private readonly IAuthenticationService _authenticationService; 11 | 12 | #endregion Field 13 | 14 | #region Constructor 15 | 16 | public CurrentUserWorkContext(IAuthenticationService authenticationService) 17 | { 18 | _authenticationService = authenticationService; 19 | } 20 | 21 | #endregion Constructor 22 | 23 | #region Implementation of IWorkContextStateProvider 24 | 25 | /// 26 | /// 获取状态信值。 27 | /// 28 | /// 状态类型。 29 | /// 状态名称。 30 | /// 获取状态值的委托。 31 | public Func Get(string name) 32 | { 33 | if (name == "CurrentUser") 34 | return ctx => (T)_authenticationService.GetAuthenticatedUser(); 35 | return null; 36 | } 37 | 38 | #endregion Implementation of IWorkContextStateProvider 39 | } 40 | } --------------------------------------------------------------------------------