Friday, June 26, 2009

eXpand Step 1 – refactoring and renaming

Related posts:
eXpand RWF = (Real world framework)--->First thoughts
eXpand Step 1 – refactoring and renaming
eXpand step 2-Singing assemblies with strong Names

Refactoring namespaces

I am going to start refactoring today and I am going to use Resharper and its rename NameSpace feature to accompish it.

I though it will be easy, but nothing is easy at this life. What happen ?

At my pc Core 2 Quad with 8G memory I tried to refactor directly the word XAFPoint which is the root namespace in all assemplies. Yes you can do that!!!

if you have for example a namespace like:

RootNameSpace.SubNameSpace1.SubSubNameSpace at assembly 1
RootNameSpace.SubNameSpace2.SubSubNameSpace at assembly 2

and you try to rename using ReSharper the RootNamepace to RenamedNameSpace you will end up with:

RenamedNameSpace.SubNameSpace1.SubSubNameSpace at assembly 1
RenamedNameSpace.SubNameSpace2.SubSubNameSpace at assembly 2

with a press of a keyboard shortcut!!!

That all are in theory of course. But for a large project like that when I try to rename the earth stop moving!!!!

See some metrics on the framework

image

see also some metrics on Xaf 

image

Ok I am not afraid of those numbers we can still do the renaming but we have to group our namespaces more in order ReSharper to hold

tip: ReSharper does not refactor projects that are not selected to be build with the active solution configuration so you have to be careful with that

Setting up project references

Projects that reference other projects should do from eXpand.dll folder so I have setup output path to that folder and by doing so I am minimizing any Visual studio designer defects since I m not referencing projects but assemblies

image

In order to to solve Unable to copy from obj\debug to bin\debug I put that script to all projects pre build event

And by clearing all build attributes from all projects in solution active configuration

image

I manage to have the ability to work and build one project at a time, imagine what will happen if I didn’t do that. My current solution has 89 projects!!! And why do I need to load on those projects? Because I need ReSharper to be aware of all code when refactoring

Renaming folders on file system

that was easy job even if they are a large number of folders

Versioning

You can enable versioning by using the following at your AssemblyInfo.cs of every project

[assembly: AssemblyVersion("1.0.0.*")]
So I put it in every project and try to build the solution again so versions will start raising

but many builds failed again!!!

but why? oops I forgot that I am referencing from eXpand.DLL so every time I build the assembly version changes. To overcome this one I should set the “Specific Version” attribute to false to all referenced assemblies

image

ok refactoring finished, now we are 1 step closer to release

_lac folder

_lac=local assembly cache. We are going to have a folder _lac alond with eXpand.DLL to store any third party library that we are going to use like mbunit,EnterpriseLibrary , etc

We hope to hear your suggestions, additions to the process taken

Subscribe to XAF feed
Subscribe to community feed

DiggIt!

0 comments:

Post a Comment