Skip to content

Instantly share code, notes, and snippets.

@mgroves
Created January 20, 2011 00:46
Show Gist options
  • Select an option

  • Save mgroves/787202 to your computer and use it in GitHub Desktop.

Select an option

Save mgroves/787202 to your computer and use it in GitHub Desktop.
lazy load 5
public override bool CompileTimeValidate(PostSharp.Reflection.LocationInfo locationInfo)
{
if(!locationInfo.LocationType.IsInterface)
{
Message.Write(SeverityType.Error, "001", "LazyLoad can only be used on Interfaces in {0}.{1}", locationInfo.DeclaringType, locationInfo.Name);
return false;
}
_type = DependencyMap.GetConcreteType(locationInfo.LocationType);
if(_type == null)
{
Message.Write(SeverityType.Error, "002", "A concrete type was not found for {0}.{1}", locationInfo.DeclaringType, locationInfo.Name);
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment