Break through the limitations of Silverlight and implement a better dynamic loading navigation mechanism (I)

Source: Internet
Author: User
Silverlight limitations on reflection

In Silverlight, reflection is subject to many restrictions. The maximum two restrictions are:

    • Only public members can be accessed through reflection, and other Members (private, protected, internal) cannot be accessed: there is no good solution for the moment.
    • Unable to obtainProgramReference Information of the set: Fortunately, mono. Cecil can bypass Silverlight's reflection restrictions through mono. Cecil to obtain reference information of the program and.
Silverlight limitations on Dynamic Loading

Silverlight has poor support for the dynamic loading mechanism, mainly manifested in:

    • Developers need to implement the built-in dynamic assembly loading solution. Of course, it is easy to load an assembly from the server, but there is no good way to obtain the program and reference information, other Assembly referenced by the Assembly cannot be automatically loaded;
    • The dynamically loaded assembly cannot be added to the current Silverlight deployment Assembly Cache (deployment. Current. Parts). Developers must cache the loaded programs and programs themselves;
    • Appdomain. Current cannot add Dynamically Loaded assembly information.
Restrictions on the built-in Silverlight navigation mechanism

Silverlight has a built-in navigation mechanism that can be seamlessly integrated with the browser navigation bar, but there are also many restrictions, such:

    • The navigation address must be the XAML file corresponding to the user control or page, rather than other user controls;
    • Due to Silverlight's limitations on reflection and dynamic loading, the built-in navigation mechanism cannot automatically load controls in the Dynamically Loaded assembly;

However, the built-in navigation can be completed by implementing the inavigationcontentloader interface. The frame control has a contentloader attribute. The default value of this attribute is pageresourcecontentloader.

Ideal solution

The ideal solution is to combine the navigation mechanism with the dynamic loading assembly. The goals to be achieved are as follows:

    1. The Silverlight assembly is not packaged and directly copied to the clientbin directory. Of course, the main assembly must be packaged; otherwise, the client Silverlight cannot be loaded and loaded;
    2. Based on the user's choice, the corresponding assembly is loaded from the server on demand, and the referenced assembly is automatically analyzed and loaded from the server;
    3. Extends the built-in navigation mechanism so that it can load Dynamically Loaded assembly.

I believe many people have already understood this solution and even have a clear idea to implement it. In the next blog, I will post my implementation, I hope you will continue to pay attention to it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.