Home Arrow Icon Knowledge base Arrow Icon Global Arrow Icon Can MvvmCross be used with other .NET frameworks like CSLA.net


Can MvvmCross be used with other .NET frameworks like CSLA.net


MvvmCross is a versatile cross-platform MVVM framework that supports various .NET platforms, including Xamarin.iOS, Xamarin.Android, Xamarin.Mac, Xamarin.Forms, Universal Windows Platform (UWP), and Windows Presentation Framework (WPF)[1]. It provides features such as MVVM architecture, navigation, data binding, platform-specific support, and dependency injection[1]. Given its flexibility and compatibility with multiple platforms, MvvmCross can be used alongside other .NET frameworks like CSLA.net.

Using MvvmCross with CSLA.net

CSLA.net is a business object framework that can be used to manage business logic and data access. It supports multiple platforms and can be integrated with MVVM frameworks to leverage the benefits of both architectures. When combining CSLA.net with MvvmCross, developers can use CSLA.net for business logic and data management while utilizing MvvmCross for UI-related tasks and cross-platform compatibility.

Integration Approach:

1. Business Logic with CSLA.net: Use CSLA.net to define business objects and manage data access. CSLA.net provides features like data validation, business rules, and data persistence, which are essential for robust business logic.

2. UI and Cross-Platform Support with MvvmCross: Implement MvvmCross for the UI layer, leveraging its MVVM architecture, data binding, and cross-platform support. This allows you to create a consistent UI across different platforms.

3. ViewModel Integration: To integrate CSLA.net with MvvmCross, you can inherit from CSLA.net's `ViewModelBase` (not `ViewModel`) and implement MvvmCross's requirements in the same class. This approach allows you to combine the strengths of both frameworks while maintaining a clean architecture[2].

Challenges and Considerations:

- Portable Class Libraries (PCLs): CSLA.net business objects may not be compatible with PCLs due to their complexity, requiring project linking instead of using PCLs directly[2].
- Platform Limitations: Be aware of platform-specific limitations, such as reflection restrictions in certain environments like Silverlight or WP8[2].

In summary, MvvmCross can be effectively used with CSLA.net by leveraging CSLA.net for business logic and MvvmCross for UI and cross-platform support. This combination allows developers to create robust, maintainable applications across multiple platforms.

Citations:
[1] https://www.mvvmcross.com/documentation/getting-started/getting-started
[2] https://stackoverflow.com/questions/17373587/how-well-would-mvvmcross-and-csla-net-work-together-in-a-multi-platform-strategy
[3] https://stackoverflow.com/questions/75320482/can-not-install-mvvmcross-9-0-9-net6-creating-a-new-android-project-in-vs2022
[4] https://www.mvvmcross.com/documentation/fundamentals/data-binding
[5] https://stackoverflow.com/questions/49688230/mvvmcross-core-platform-5-7-0-was-restored-using-netframework-version-v4-6-1
[6] https://github.com/MvvmCross/MvvmCross
[7] https://www.mvvmcross.com
[8] https://cslanet.com/old-forum/8575.html