This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Serializable] | |
| public sealed class LazyLoadAttribute : LocationInterceptionAspect | |
| { | |
| private Type _type; | |
| public override bool CompileTimeValidate(PostSharp.Reflection.LocationInfo locationInfo) | |
| { | |
| _type = DependencyMap.GetConcreteType(locationInfo.LocationType); | |
| if(_type == null) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Serializable] | |
| public sealed class LazyLoadAttribute : LocationInterceptionAspect | |
| { | |
| private Type _type; | |
| public override bool CompileTimeValidate(PostSharp.Reflection.LocationInfo locationInfo) | |
| { | |
| _type = DependencyMap.GetConcreteType(locationInfo.LocationType); | |
| if(_type == null) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public override bool CompileTimeValidate(PostSharp.Reflection.LocationInfo locationInfo) | |
| { | |
| if(!locationInfo.LocationType.IsInterface) | |
| { | |
| Message.Write(SeverityType.Error, "001", "LazyLoad can only be used on Interfaces!"); | |
| return false; | |
| } | |
| _type = DependencyMap.GetConcreteType(locationInfo.LocationType); | |
| if(_type == null) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [LazyLoad] private IProductRepository _productRepository; | |
| [Serializable] | |
| public sealed class LazyLoadAttribute : LocationInterceptionAspect | |
| { | |
| public override void OnGetValue(LocationInterceptionArgs args) | |
| { | |
| args.ProceedGetValue(); // this actually fetches the field and populates the args.Value | |
| if (args.Value == null) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Serializable] | |
| public sealed class LazyLoadAttribute : LocationInterceptionAspect | |
| { | |
| private Type _type; | |
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [Serializable] | |
| public sealed class LazyLoadAttribute : LocationInterceptionAspect | |
| { | |
| private Type _type; | |
| public override bool CompileTimeValidate(PostSharp.Reflection.LocationInfo locationInfo) | |
| { | |
| _type = DependencyMap.GetConcreteType(locationInfo.LocationType); | |
| if(_type == null) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <#@ template language="C#" hostspecific="true" #> | |
| <#@ import namespace="System.IO" #> | |
| <#@ import namespace="System" #> | |
| <#@ import namespace="System.Collections.Generic" #> | |
| <# | |
| string TestXml = | |
| @"<?xml version=""1.0"" encoding=""utf-8""?> | |
| <WebTest Name=""{0}"" Id=""{2}"" Owner="""" Priority=""0"" Enabled=""True"" CssProjectStructure="""" CssIteration="""" Timeout=""0"" WorkItemIds="""" xmlns=""http://microsoft.com/schemas/VisualStudio/TeamTest/2006"" Description="""" CredentialUserName="""" CredentialPassword="""" PreAuthenticate=""True"" Proxy="""" StopOnError=""False""> | |
| <Items> | |
| <Request Method=""GET"" Version=""1.1"" Url=""{{{{webserver}}}}/freecache.aspx"" ThinkTime=""0"" Timeout=""300"" ParseDependentRequests=""True"" FollowRedirects=""True"" RecordResult=""True"" Cache=""False"" ResponseTimeGoal=""0"" Encoding=""utf-8"" ExpectedHttpStatusCode=""0"" ExpectedResponseUrl="""" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private IProductRepository _productRepository; | |
| private IProductRepository ProductRepository | |
| { | |
| get | |
| { | |
| if(_productRepository == null) | |
| { | |
| _productRepository = new ProductRepository(); | |
| } | |
| return _productRepository; |