I am pleased to announce the release of Fasterflect 2.0. For those who are not aware of Fasterflect, it is a library that helps you get rid of the complexity and slow performance of .NET Reflection. Check out this Code Project article and a previous announcement for an introduction.
Fasterflect 2.0 comes with a great number of additions & changes, which are possible thanks to the fact that I am no longer the only developer of this project; instead, Morten Mertner (author of Gentle.NET) has joined me since the beginning of 2.0 and made huge contribution ever since. Let’s look at some highlights of this release.
The most exciting addition in this release is that Fasterflect now includes a Query API. Previously you can only use Fasterflect to construct objects or performs invocations (these 2 usages are now referred as Access API). With this release, you can query .NET reflection metadata with Fasterflect although much simpler than what you have to do with the built-in .NET reflection. You can even do more thing with this Query API than you can with .NET reflection out of the box. For example, you can choose to exclude backing members from a lookup or enable partial-name lookup. All you need to do in order to have these level of control is specifying a proper Fasterflect binding flag. The nice thing about Fasterflect binding flag is that it is also fully supported in the Access API.
Next, the Access API is now fully integrated with .NET reflection metadata classes, such as ConstructorInfo, MethodInfo, FieldInfo etc. This integration makes it able for you to mix & match the usages of Query API and Access API as well as allows you to use .NET reflection as it is while delegating the invocation to the fast CIL-generation engine of Fasterflect.
We have also built on top of the core Fasterflect engine some add-on services such as advanced object construction, deep cloning and object mapping. We expect to have more of these services in future releases and of course, you can send us your contributions too.
Users of previous versions of Fasterflect should be aware of the following breaking changes.
- Many existing extension methods have their names changed as we went through the process of improving API’s consistency & usability. We hope these changes are for the better because now we have 2 developers vote on the conventions instead of 1 like previously
. You would have to make some code change when switching from 1.1 to 2.0, but the changes should be very straight-forward in most cases except for the other changes described below.
- Fasterflect extension methods now don’t require a type parameter, which we have found to be inconvenient because people are forced to append <object> to the call even when they don’t care about the return value or its type. These methods now simply return result of type System.Object and you can cast to the correct type if you need to.
- Batch fields/properties setting are gone. They are replaced by the object mapping add-on service which is more flexible, sophisticated and faster (CIL code generation is used behind the scene). Batch setting of static members is not supposed though because we think it’s not a common scenario. That said, do let us know if you have this need and we will add support for it in the next minor release.
- The class Reflector and its methods are now gone. We instead employ a custom-built weak reference-based cache to assure that generated CIL can be garbage-collected when memory is low.
Last but not least, the project wiki on CodePlex is fully populated with comprehensive documentation. While Fasterflect is still ridiculously easy to use, it now has a much bigger API and is more sophisticated than it used to be (e.g. with Fasterflect binding flags). Therefore, documentation should be of great help for those who want to understand everything about Fasterflect to use it effectively in even advanced scenarios without having to dig through the source code.
You can download the binary, source code and CHM API help file in the Fasterflect 2.0 release page in CodePlex. If you want to explore Fasterflect in details, surf through the project wiki. If you just want to jump right into the usages without any further introduction, check out the 2-minute-guide to Access API and this page about the Query API. Finally, the comprehensive unit test suite included in the code download can also serve as good reference for the API.
By PDGACO payday loans