1

I am working on a project wherein I am using a external open-source library for managing roles of forms authenticated users on my SharePoint web application (http://sharepoint2010fba.codeplex.com/).

All the functionality (for e.g. creating new roles, users etc.) are coded in to the aspx code-behind events. Now I need to extend these methods to add more functionality.

What would be the best design approach to extend the functionality in the scenario as above?

Thanks, Sharath

Sharath Chandra
  • 654
  • 8
  • 26
  • I think you could override the events, but can you post some code examples of those events? – Mentoliptus Nov 21 '11 at 07:23
  • I will not be able to override the events directly as the code is events aren't virtual methods, for e.g. there is a method "protected void OnSubmit(object sender, EventArgs e){ //some code }". Now I am looking at extending the functionality of this without altering the source code. – Sharath Chandra Nov 23 '11 at 18:43
  • If the methods are not `virtual`, you can still extend them by using the `new` keyword instead of the `override` keyword. Just be shure to use the sam method signature! Let me know if this helps! – Mentoliptus Nov 23 '11 at 21:26

1 Answers1

0

One way to extend code without changing the original code is to use MEF, the Managed Extensibility Framework.

MEF targets .net framework 4.0, since you are using SharePoint you are probably on 3.5.

See Does MEF require .NET 4? for how to get MEF to work on 3.5.

Community
  • 1
  • 1
Shiraz Bhaiji
  • 64,065
  • 34
  • 143
  • 252