Profile mini-profiler steps across multiple methods, assemblies - mvc-mini-profiler

I've recently discover mini-profiler and I love it. Unfortunately I'm using EF 5 so I can't use the EF profile element but it's still very useful.
My question is; can I profile a across multiple methods to produce a rolled up step say across by business layer and across the entire repository.

A single MiniProfiler.Step profiles everything that happens within the using section enclosing the Step. This includes calls to methods in other methods and assemblies. So there is no reason why this should not be able to work.

Related

How do I Split Application into a new Version for a different User Base?

We have a website application that stores data and pictures for a specific customer. We are about to release the same application for use by another customer. The second application will eventually be customized for the second customer. Eventually we hope to have several customers using their own versions of the application.
We are using ASP.NET in Visual Studio 2012. Should we:
clone the existing application and maintain separate code bases?
add a project to the existing solution for the new customer?
We have searched for an answer to but this seems to be a rare situation.
Thanks.
I dont think its rare at all. SAP and Maximo use this a a businiess model. Same core but each package customized to the clients specifications. I have done this (on a much much smaller scale) with some of the programs that we have.
We always start a new project rather than just copy the old. No telling what is in the old one that references the old client. Sort of embarasing when an About window that you forgot about is for someone elses company.
All the code, forms, reports that are customizeable should be in the project for that customer. All of the code, forms, reports that are standard should be in a library.
It really depends on the scope of the application. I've had to do this internally with the company I'm working for; I wrote one solution for one company, then the sister company found out and wanted the same and had to implement it there.
I had a fairly small project to work on, so it was easy to make it universal (while also keeping things rooting from the same code base). All i did was:
break out the unique setting [page title?] using appSettings or similar.
add a new configuration to your solution. Then take advantage of the *.config migrations to:
set connectionStrings
specify appSettings values
When it comes to unique business logic, I had the luxury of using the *.config migrations (most of the data I gathered came from WCF endpoints of services local to the company)--so I lucked out. However, you could make generic interfaces within the app then break out implementation for each company in to separate libraries.

ASP.NET - Reusing a UI across multiple projects?

Here's the situation:
A while ago, I created a back-end interface for adding/modifying/deleting items in a DB. It was created as an individual project, and we are still using that particular instance of the code. I will call this "version 1".
A little while after I completed this, I duplicated the code and integrated it into a much larger project. I copied all of the DB tables that were used in the original project's DB into the DB that this project was already using. I also had to duplicate the front-end here, but it's the back-end that I'm concerned with. The requirements for this interface (I will call this "version 2") were a bit more complex, so I had to keep working on it and also make some modifications to the DB tables.
It is essentially 2 branched versions of the same interface. However, version 1 has not received much attention since version 2's conception. Some of the changes I made in version 2 were not just new features, but improvements/bug fixes that are relevant to version 1. I should have made these changes on version 1 as well, but unfortunately I didn't. Going forward I will need to make improvements to both versions, and some of these improvements will apply to both of them.
I would really like to merge the 2 interfaces somehow, as I'm quite sure that it will reduce my workload in the long run. Frankly, I would like to abandon version 1 and adapt the version 2 UI to version 1's DB.
My first instinct is to transport everything to a user control that has a "version" attribute. The version would then be used to hide/show the controls that are or aren't relevant to that version, and it would also be used to determine what DB queries/stored procedures to use. The issue with this is that this whole interface spans across 5 pages. A few of these pages are opened up as dialogs from another one of the 5 pages. I suppose that I could simply have one div per interface, and then when !IsPostBack, I can set the Visible property of each div according to a querystring variable. However, this seems like it would be awfully messy and it would be a LOT of code and markup on one page. I guess alternatively I could have 5 user controls, but this just seems like an odd design.
Are there any other viable solutions?
i've been maintaining 4 products with nearly identical interfaces:
they started from one project
got cloned and branched
i've been slowly re-merging them
The best suggestion i have is try to some up with a UI that works for both, and switch both to using that.
After that i have a project-local settings file, which defines which features should not exist in one or the other.

Is MVC 3 Scaffolding usable in n-layer applications?

I've seen some examples of ASP.NET MVC3 Scaffolding but those are always simple basic applications. What about layered/tiered solution with several Projects:
/Data
/Repository
/Services
/UI (MVC3)
The basic scaffolding pushes everything into the controller.
Can the scaffolding template be customized so it takes POCOs from Data project, then creates repository in a Repository project, services in a Service project and finally creates a thin controller in MVC that knows nothing about the data context?
I'm little confused because it's a real productivity booster.
If you use the -Repository flag, you get a repository. With the default templates, that goes in the Model folder (if using areas, it goes in the corresponding Area Model folder).
You can customise the templates that MvcScaffolding uses (see Steven Sanderson MVCConf2 video). However, to get things to go into separate projects, etc, is going to be difficult, if you have never used powershell script.
There is of course, nothing to stop you moving the files, renaming the namespaces, etc. Yes it takes a bit of work, but it is a lot better than nothing. I do it, it takes me all of 10 minutes.
I would expect someone will produce a NuGet package of that sort of thing soon, or else extra tooling to make it easier.
As you say, it is a productivity booster, but maybe you still just gotta do a bit yourself.
Check out the Nuget mvcscaffolding project - good blog posts at
http://blog.stevensanderson.com/2011/04/08/mvcscaffolding-scaffolding-custom-collections-of-files/
You can customize this to be aware of whatever layers you want and surely can reference other repository based projects etc.

Is the storing of multiple products under a single TFS project a bad idea?

We have Team Foundation Server 2008 deployed as our source control management system. A team that is responsible for multiple products is asking for all their products to be put under a single TFS project. Their reason is because the products are all in a similar domain.
Here are my reasons against:
The workspace mappings will get weird, since projects will be mapped to subfolders
Continuous Integration may be a problem, since a single project can't be referenced
Tracking history of source control activity could be problematic
This just feels like an overall bad idea, but I would like some concrete reasons against it. If I'm completely off-base and this is a good approach to take, I'd like to hear that as well.
What are the pros/cons?
I have experience storing multiple Visual Studio Solutions (seperate products) under one TFS Team Project in both TFS2008 and TFS2010. Here is my take.
In both versions we create a folder for the Product, then a folder for the branches (Main, etc.) This makes it easy to see what product we are working on, and we can see the history of the product seperate from other products. Continuous integration works just fine with multiple build definitions, one for each product. We only create one workspace mapping for the entire TFS Team Project.
The shortfall in TFS2008 is that it can be difficult to manage work items for each Product. In TFS2008 the work items apply to the entire Team Project and it is not as easy as it should be to figure out which work item belongs to which product.
In TFS2010 the work items have an Areas and Iterations section. We use the Area to define the Product. So each Work Item gets an Area that matches the Product name. This has worked very well for us.
If you are not using work items heavily in TFS2008 than I don't think you should avoid putting multiple Products in one TFS Team Project, certinally not for the reasons you listed above.
Using one Team Project does haves some advantages:
1. There is ony one Team Project to manage and there is only one Share Point site.
2. You can see history across the entire Team Project easily.
My thoughts:
If there are assemblies shared amongst the projects, it makes sense to lump them together, otherwise you will run into the same problems that many people have discussed here, on how to handle shared assemblies.
You shouldn't encounter any problems with workspace mappings. Within our organization, we simply map $/ to a folder and go from there. Otherwise you could very easily map individual source control folders to different areas on disk. The only recommendation I would have is to put that mapping in a batch file, so that new members can run the batch and be consistent.
The only thing that you might lose out on a bit by lumping these all together is quick and easy reporting. If everything is in its own Team Project, the built-in reporting works "out of the box." If you put things together, you'll need to set up additional areas and iterations in order to do the reporting and tracking.
In our organization we have upward of 15 separate team projects, but every single one of them has more than one "product" underneath. We've been running this way for two years and really haven't had any problem with it, with the exception of the reporting.
Using a single Team Project for more than one software is a perfectly acceptable solution if you don't use separate templates for them. Martin Hinshelwood has a detailed blog post on the subject.
http://blog.hinshelwood.com/when-should-i-use-areas-in-tfs-instead-of-team-projects-in-team-foundation-server-2010/

Problem with large solutions and service factory

My team is developing WCF services in Visual Studio 2008 SP1 with the Service Factory Modeling Edition. The problem is that we have so many services to develop and we've put everything in the same solution.
250 projects later, the solution barely loads and adding to it is nearly impossible. We thought it would be good to split out every service into its own solution, but the service factory stuff effectively prevents us from doing that.
We are generating code from our model project into our other projects, but if we try to use multiple solutions, we can't reference the model project because it can't maintain the project mappings it needs in order to generate to the proper location. And we use a couple shared data contracts in our Model Project, so splitting the model project up doesn't seem to make sense either.
We have so many projects now that we can't really turn back and not use the service factory method of doing everything.
What should we do?
At this point you should break up your 250 projects into groups and create a solution for each of them. My recomendation is to use ~25 projects per solution. Use these mini-solutions for your day to day editting.
It is still possible to do a full build of the overall solution via msbuild and the command line. But VS was not meant to handle so many projects at the sametime.
I'm surprised to hear you say this. I used the Service Factory in my previous job, and we created a separate solution for each suite of services. In each solution, we created one or more models in the model project.
I recommend that you experiment by creating a couple of new SF solutions, adding a couple of models and generating code. See if that causes any problems.
Have you discussed this or created an issue on CodePlex?
I agree with John Saunders. Keep them small. Also, keep a Continuous Integration env running to keep track of your mess-ups during development.

Resources