Dynamic assemblies and serialization

The AbstractBindableWrapper is getting more and more difficult. I am facing a lot of problems regarding Windows Forms and WPF databinding and of course regarding Reflection.Emit. AOP is very cool but is not easy to implement. I've written a dynamic proxy generator which creates an assembly and classes inside it. The idea is to have a double proxy for every business object that needs to be bound to the UI.

  1. The first proxy extends the business object and implements the INotifyPropertyChanged interface. This proxy is created with the DynamicPropertyChangedProxy class. It has been a challenge to write that class.
  2. The second one uses the interception pattern and is generated by Castle.DynamicProxy2 and its purpose is to raise the PropertyChanged event everytime the bound properties are changed. This second extends from the first

Now the last problem I've found is the deserialization of a class that is contained within a dynamic assembly, that is, the deserialization of the proxies. I've found also the solution and implemented it. It is working fine.

"In general, the formatter, during deserialization, loads the assembly by calling Load or LoadWithPartialName and because of which CLR will not find a dynamic assembly. One solution is to provide an event handler for AppDomain.CurrentDomain.AssemblyResolve event which gets called whenever the formatter fails to load an assembly. The identity of the assembly that failed during load is passed to this method. Your event handler can use the name to construct a path where the assembly file is available and use Assembly.LoadFrom(assemblyPath) to return Assembly."

   1:  public static Assembly OnAssemblyResolve(Object sender, ResolveEventArgs args)
   2:  {
   3:      if (args.Name.StartsWith(DYNAMIC_MOD_NAME))
   4:      {
   5:          return Assembly.GetAssembly(MyAssemblyBuilder.GetTypes()[0]);
   6:      }
   7:      return null;
   8:  }

The idea is to release Boxerp 0.2 within a month including all this stuff and these posts are part of the documentation.

  • http://doit.tweeteigo.jp/blogs/6086/127176/all-the-unwanted-lady8217 ugg boots in uk

    strongzz whoah this blog is great i love reading your posts. Keep up the good work! You know, many people are searching around for this info, you can help them greatly.

  • http://www.mysocialbookmarking.info/story.php?title=gutter-cleaners-sydney gutter cleaners

    This is actually great content. Thanks for this. I put it on my website where you can also find latest game and technology news and reviews . I linked returning to your site and bookmarked it in order to see your new posts.