This file contains 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
using System; | |
using FluentAssertions; | |
using Microsoft.VisualStudio.TestTools.UnitTesting; | |
namespace ThirteenDaysAWeek.TypeLoadFromString.Tests | |
{ | |
[TestClass] | |
public class TypeLoadTests | |
{ | |
[TestMethod] |
This file contains 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
namespace ThirteenDaysAWeek.TypeLoadFromString | |
{ | |
public interface IDomainModel | |
{ | |
} | |
public class Domain<T> | |
where T : IDomainModel | |
{ | |
public T Model { get; set; } |
This file contains 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 Type GetTypeFromString() | |
{ | |
string typeName = "ThirteenDaysAWeek.TypeLoadFromString.Domain`1[[ThirteenDaysAWeek.TypeLoadFromString.CustomerModel, ThirteenDaysAWeek.TypeLoadFromString, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]"; | |
Type theType = Type.GetType(typeName); | |
return theType; | |
} |
This file contains 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
<system.web> | |
<httpRuntime maxQueryStringLength="32768" maxUrlLength="32768" /> | |
</system.web> |
This file contains 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
<system.webServer> | |
<security> | |
<requestFiltering> | |
<requestLimits maxUrl="32768" maxQueryString="32768" /> | |
</requestFiltering> | |
</security> | |
</system.webServer> |
This file contains 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 abstract class BaseHttpModule : IHttpModule | |
{ | |
public void Init(HttpApplication application) | |
{ | |
application.BeginRequest += (sender, args) => | |
OnBeginRequest(new HttpContextWrapper(((HttpApplication)sender).Context)); | |
} | |
public virtual void OnBeginRequest(HttpContextBase context) | |
{ |
This file contains 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 class MyHttpModule : IHttpModule | |
{ | |
public void Init(HttpApplication appliction) | |
{ | |
application.BeginRequest += (sender, eventArgs) => { | |
HttpContext currentContext = (HttpContext)sender; | |
// Do cool stuff here, probably with the currentContext var | |
}; | |
} | |
This file contains 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 static void Start() | |
{ | |
DynamicModuleUtility.RegisterModule(typeof(OnePerRequestHttpModule)); | |
DynamicModuleUtility.RegisterModule(typeof(NinjectHttpModule)); | |
bootstrapper.Initialize(CreateKernel); | |
} |
This file contains 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 void SetupGestureRecognizer() | |
{ | |
this.MapView.AddGestureRecognizer(new UITapGestureRecognizer(r => { | |
PointF pointInView = r.LocationInView(this.MapView); | |
CLLocationCoordinate2D touchCoordinates = this.MapView.ConvertPoint(pointInView, this.MapView); | |
MKMapPoint mapPoint = MKMapPoint.FromCoordinate(touchCoordinates); | |
foreach (NSObject overlay in this.MapView.Overlays) | |
{ | |
if (overlay is MKPolygon) |
This file contains 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 class MapDelegate : MKMapViewDelegate | |
{ | |
public override MonoTouch.MapKit.MKOverlayView GetViewForOverlay (MKMapView mapView, NSObject overlay) | |
{ | |
MKPolygon polygon = overlay as MKPolygon; | |
MKPolygonView polygonView = new MKPolygonView(polygon); | |
polygonView.FillColor = UIColor.Purple; | |
return polygonView; | |
} |