PostSharp with SubSonic

Share with us how you use PostSharp, or how you would like to use it.

PostSharp with SubSonic

Postby mchastings on Tue Jul 15, 2008 5:25 am

Hello,

I am new to PostSharp and AOP so I apoligize if this obvious. I will assume everyone here is familiar with SubSonic. We use SS to generate active record classes for our Asp.NET application. It generates nice ActiveRecord objects somewhat like :

class Widget
}

public Widget()

public string WidgetName
public string WidgetDesc

public Save()

public static Destroy(int id)
}


This is nice when I want to access the database, but it seems irresponsible to pass around an object with so much power. For example if I have a WebForm that displays a widget, I don't want the developer colding the webform to be tempted to call the Save() or Destroy() methods instead of using my business services.


Is there a way to use PS to transform the above class into something like this.


class Widget
}

public string WidgetName
public string WidgetDesc

}



Thank you for your help,

Mitch
mchastings
 
Posts: 1
Joined: Tue Jul 15, 2008 5:14 am
Last Name: Mitch

Re: PostSharp with SubSonic

Postby gfraiteur on Tue Jul 15, 2008 8:52 pm

Hi,

This is pretty easy to do, but you have to use PostSharp Core for this... which is no that easy ;).
Gael Fraiteur, project leader
gfraiteur
Site Admin
 
Posts: 834
Joined: Tue Dec 18, 2007 3:09 pm
First Name: Gael
Last Name: Fraiteur
Company: postsharp.org


Return to What To Do With PostSharp?