ps-projects - PS.IoC.Autofac 2.16.0
Autofac IoC adaptation
PM> Install-Package PS.IoC.Autofac -Version 2.16.0 -Source https://www.myget.org/F/ps-projects/api/v3/index.json
> nuget.exe install PS.IoC.Autofac -Version 2.16.0 -Source https://www.myget.org/F/ps-projects/api/v3/index.json
> dotnet add package PS.IoC.Autofac --version 2.16.0 --source https://www.myget.org/F/ps-projects/api/v3/index.json
source https://www.myget.org/F/ps-projects/api/v3/index.json
nuget PS.IoC.Autofac ~> 2.16.0
Copy to clipboard
> choco install PS.IoC.Autofac --version 2.16.0 --source https://www.myget.org/F/ps-projects/api/v2
Import-Module PowerShellGet
Register-PSRepository -Name "ps-projects" -SourceLocation "https://www.myget.org/F/ps-projects/api/v2"
Install-Module -Name "PS.IoC.Autofac" -RequiredVersion "2.16.0" -Repository "ps-projects"
Copy to clipboard
Build
Branch | Build status |
---|---|
Master | |
CI |
Packages
Name | Master | CI |
---|---|---|
PS.Primitives | ||
PS.WPF | ||
PS.MVVM | ||
PS.MVVM.WPF | ||
PS.IoC | ||
PS.IoC.Autofac | ||
PS.IoC.Microsoft.DependencyInjection | ||
PS.Windows.Interop |
Description
Lightweight and fast MVVM framework. This framework is designed to be generic, allowing for flexibility and adaptability. However, all future implementations will be specifically tailored for WPF (Windows Presentation Foundation).
Tutorial
Quick tutorial documentation can be found here:
How It Works
To ensure the correct resolution of any element, it's essential to register it. There are two primary items to be aware of when working with this system:
ViewModel Type Registration
The core key for registration is the ViewModel Type
. This allows you to register payload items for the ViewModel type you're testing, whether it's of the same type or inherited from it.
Elements for View Rendering
There are three main kinds of elements that play a role in view rendering:
DataTemplate for DataTemplateSelector:
DataTemplate: A DataTemplate is used in WPF to define the visual representation of data. It describes how data should be displayed, allowing developers to create a template that defines how data objects are rendered in UI elements like ListBox, ComboBox, and more.
Usage Example:
service.AssociateTemplate<ShellViewModel>(dataTemplateInstance);
DataTemplateSelector: This is a class in WPF that lets you choose a DataTemplate based on custom logic. It becomes particularly useful when you have multiple templates and you want to select one based on the properties of the data object.
Style for StyleSelector:
Style: Styles in WPF empower developers and designers to establish a consistent appearance across their applications. By defining the look and feel of UI elements, styles help in creating visually compelling and uniform effects across the application.
Usage Example:
service.AssociateStyle<ShellViewModel>(XamlResources.ShellWindowStyle);
StyleSelector: This class in WPF is used to apply styles based on custom logic. It determines how a style is selected for a row or an item, contingent on specific conditions.
ItemContainerTemplate for ItemContainerTemplateSelector:
ItemContainerTemplate: This template in WPF provides the blueprint for producing a container for an ItemsControl object. It essentially dictates how each item's container should be structured and styled within controls like ListBox or ComboBox.
Usage Example:
service.AssociateContainer<ShellViewModel>(itemContainerTemplateInstance);
ItemContainerTemplateSelector: This selector allows for the application of custom logic to pick an ItemContainerTemplate.
Generic Association
For a more streamlined approach, you can use a generic method to associate all the elements at once:
Usage Example:
service.Associate<ShellViewModel>(
template: dataTemplateInstance,
style: XamlResources.ShellWindowStyle,
container: itemContainerTemplateInstance);
Core Features
Built-in Selectors: The framework provides native selectors for Data, Style, and Container. These selectors facilitate efficient data binding, style management, and container operations in WPF contexts.
DI Framework Integration: PS.Framework integrates seamlessly with established Dependency Injection (DI) frameworks, specifically Autofac and Microsoft dependency injection. This integration allows for dependency resolution and inversion of control, leading to modular and testable code structures.
Scalability: PS.Framework is scalable, catering to both small-scale utilities and large enterprise applications. It ensures consistent performance and responsiveness across varying project sizes.
Toolset: The framework includes a suite of tools and services that enhance WPF development, reducing boilerplate and improving efficiency.
MVVM Services
In essence, the PS.MVVM project provides tools and services to facilitate the implementation of the MVVM pattern, making it easier for developers to separate their application's logic from its presentation.
BroadcastService
This service provides functionality to broadcast events to subscribers. It maintains a list of subscriptions and allows for broadcasting events to these subscribers. The service provides methods to subscribe and unsubscribe from events. It uses a synchronization context to ensure thread safety.
CommandService
This service deals with commands in the MVVM pattern. It maintains a registry of commands and provides methods to add commands, create views of commands, and find commands. The service can handle activation of commands and provides event handling capabilities.
ModelResolverService
This service provides functionality to resolve models. It maintains storage for observable model collections and observable model objects. The service provides methods to retrieve these observable collections and objects.
ViewResolverService
This service is responsible for resolving views. It maintains associations between consumer service types, view models, and regions. The service provides methods to associate views and find associated views.
MVVM WPF Adaptation
The PS.MVVM.WPF
project within the PS.Framework repository provides a set of components, services, and view models tailored for WPF applications, particularly for implementing the MVVM (Model-View-ViewModel) pattern. Here's a brief overview of the components:
Resolvers
In the MVVM architecture within WPF applications, resolvers play a pivotal role in dynamic UI determination. They ensure the appropriate visual elements are chosen based on the underlying data contexts.
BaseResolver:
- An abstract generic base class tailored for service interactions within XAML. It provides foundational mechanisms for consistent service retrieval across derived resolvers.
BaseViewResolver:
- A specialized XAML resolver for operations with the
IViewResolverService
. The service interacts with three distinct selectors:- StyleResolver: Works with WPF's
StyleSelector
, determining the right style for views. - ContainerResolver: Engages with
ItemContainerTemplateSelector
, ensuring the correct container for items in collection controls. - TemplateResolver: Operates with
DataTemplateSelector
, selecting the appropriate data template based on the data context.
- StyleResolver: Works with WPF's
- A specialized XAML resolver for operations with the
WindowService:
Service offers methods to display windows, either in a standard or modal fashion, based on the associated view model. This ensures a clear separation of concerns between the view and its underlying logic, adhering to the principles of the MVVM pattern.
-
.NETFramework 4.7.2
- Autofac (>= 8.0.0)
- PS.IoC (>= 2.16.0)
-
.NETFramework 6.0
- Autofac (>= 8.0.0)
- PS.IoC (>= 2.16.0)
-
.NETFramework 8.0
- Autofac (>= 8.0.0)
- PS.IoC (>= 2.16.0)
-
.NETStandard 2.0
- Autofac (>= 8.0.0)
- PS.IoC (>= 2.16.0)
- .NETFramework 4.7.2: 4.7.2.0
- .NETFramework 6.0: 6.0.0.0
- .NETFramework 8.0: 8.0.0.0
- .NETStandard 2.0: 2.0.0.0
OwnersBlackGad |
AuthorsVolodymyr Shkolka |
Project URLhttps://github.com/BlackGad/PS.Framework |
LicenseUnknown |
TagsFramework IoC Standard Autofac |
Info175 total downloads |
3 downloads for version 2.16.0 |
Download (43.28 KB) |
Found on the current feed only |
Package history
Version | Size | Last updated | Downloads | Mirrored? | |||
---|---|---|---|---|---|---|---|
2.16.0 | 43.28 KB | Sat, 11 May 2024 07:13:35 GMT | 3 | ||||
2.15.0 | 33.83 KB | Sun, 08 Oct 2023 16:06:35 GMT | 3 | ||||
2.14.4 | 33.73 KB | Sun, 08 Oct 2023 16:02:35 GMT | 4 | ||||
2.13.3 | 30.78 KB | Wed, 12 Apr 2023 15:30:48 GMT | 4 | ||||
2.13.2 | 30.77 KB | Tue, 11 Apr 2023 12:37:58 GMT | 4 | ||||
2.13.1 | 30.78 KB | Sun, 09 Apr 2023 21:20:11 GMT | 4 | ||||
2.13.0 | 30.78 KB | Sat, 08 Apr 2023 12:47:42 GMT | 4 | ||||
2.11.0 | 29.84 KB | Thu, 15 Sep 2022 13:29:13 GMT | 4 | ||||
2.10.0 | 29.82 KB | Thu, 15 Sep 2022 13:20:02 GMT | 4 | ||||
2.9.14 | 29.84 KB | Thu, 15 Sep 2022 13:02:26 GMT | 4 | ||||
2.9.12 | 29.84 KB | Thu, 15 Sep 2022 12:41:59 GMT | 4 | ||||
2.9.11 | 29.42 KB | Mon, 12 Sep 2022 12:45:59 GMT | 3 | ||||
2.9.10 | 29.43 KB | Wed, 07 Sep 2022 10:36:40 GMT | 4 | ||||
2.9.9 | 29.39 KB | Wed, 07 Sep 2022 09:17:11 GMT | 4 | ||||
2.9.8 | 29.41 KB | Mon, 05 Sep 2022 12:09:21 GMT | 4 | ||||
2.9.6 | 29.41 KB | Mon, 05 Sep 2022 11:52:14 GMT | 4 | ||||
2.9.5 | 29.4 KB | Tue, 23 Aug 2022 13:06:10 GMT | 4 | ||||
2.9.4 | 29.41 KB | Fri, 19 Aug 2022 07:45:20 GMT | 4 | ||||
2.9.1 | 29.4 KB | Mon, 23 May 2022 13:33:39 GMT | 3 | ||||
2.7.1 | 29.39 KB | Sat, 14 May 2022 18:13:16 GMT | 4 | ||||
2.2.18 | 27.64 KB | Mon, 25 Oct 2021 15:45:19 GMT | 4 | ||||
2.2.17 | 27.64 KB | Mon, 25 Oct 2021 15:04:00 GMT | 4 | ||||
2.2.16 | 27.64 KB | Sat, 23 Oct 2021 14:47:33 GMT | 4 | ||||
2.2.15 | 27.64 KB | Fri, 22 Oct 2021 21:51:59 GMT | 4 | ||||
2.2.13 | 27.65 KB | Fri, 22 Oct 2021 17:57:03 GMT | 4 | ||||
2.2.12 | 27.64 KB | Sun, 17 Oct 2021 21:14:17 GMT | 4 | ||||
2.2.11 | 27.65 KB | Thu, 14 Oct 2021 12:50:54 GMT | 4 | ||||
2.2.9 | 27.62 KB | Wed, 13 Oct 2021 22:49:06 GMT | 4 | ||||
2.2.8 | 27.62 KB | Sat, 09 Oct 2021 23:02:06 GMT | 4 | ||||
2.2.5 | 27.61 KB | Sat, 02 Oct 2021 22:08:27 GMT | 4 | ||||
2.2.4 | 19.42 KB | Sat, 02 Oct 2021 21:19:41 GMT | 4 | ||||
2.2.3 | 19.42 KB | Wed, 29 Sep 2021 15:24:42 GMT | 3 | ||||
2.2.1 | 18.97 KB | Wed, 29 Sep 2021 14:06:56 GMT | 4 | ||||
2.0.4 | 18.52 KB | Sun, 21 Mar 2021 21:52:30 GMT | 4 | ||||
2.0.0 | 10.32 KB | Sun, 29 Mar 2020 19:06:26 GMT | 4 | ||||
1.11.2 | 18.11 KB | Sat, 23 Nov 2019 15:59:03 GMT | 4 | ||||
1.11.1 | 17.89 KB | Tue, 30 Jul 2019 20:39:32 GMT | 4 | ||||
1.11.0 | 17.87 KB | Sat, 27 Jul 2019 19:43:14 GMT | 4 | ||||
1.10.6 | 17.82 KB | Fri, 12 Jul 2019 14:30:50 GMT | 4 | ||||
1.10.5 | 17.82 KB | Thu, 11 Jul 2019 22:31:18 GMT | 4 | ||||
1.10.4 | 17.82 KB | Thu, 11 Jul 2019 21:53:06 GMT | 4 | ||||
1.10.3 | 17.82 KB | Thu, 11 Jul 2019 21:41:22 GMT | 4 | ||||
1.10.2 | 17.82 KB | Thu, 11 Jul 2019 20:51:21 GMT | 4 | ||||
1.10.1 | 17.81 KB | Thu, 11 Jul 2019 20:04:29 GMT | 4 | ||||
1.0.4 | 17.78 KB | Thu, 11 Jul 2019 13:10:28 GMT | 4 |