Last active
October 14, 2016 20:17
-
-
Save KevM/6074941 to your computer and use it in GitHub Desktop.
FubuMVC: Model binding challenged. My scenario seems to be what the NestedObjectPropertyBinder was created for but I cannot get it working The endpoint using this input model is binding everything perfectly except the Address properties
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
DatabaseIdentifier:268435457 | |
Name:Dovetail Software | |
SiteId:INT1 | |
Phone:512-610-5400 | |
Fax:512-610-5470 | |
Region:Central | |
District:SC | |
Type:Internal | |
Status:Active | |
PrimaryDatabaseIdentifier:268437810 | |
PrimaryAddress1:1 | |
PrimaryAddress2:Bldg 4 Suite 200 | |
PrimaryCity:Austin | |
PrimaryStateOrProvince:TX | |
PrimaryPostalCode:78759 | |
PrimaryCountry:USA | |
PrimaryTimeZone:CST | |
BillingDatabaseIdentifier:268437810 | |
BillingAddress1:4807 Spicewood Springs Rd | |
BillingAddress2:Bldg 4 Suite 200 | |
BillingCity:Austin | |
BillingStateOrProvince:TX | |
BillingPostalCode:78759 | |
BillingCountry:USA | |
BillingTimeZone:CST | |
ShippingDatabaseIdentifier:268437810 | |
ShippingAddress1:4807 Spicewood Springs Rd | |
ShippingAddress2:Bldg 4 Suite 200 | |
ShippingCity:Austin | |
ShippingStateOrProvince:TX | |
ShippingPostalCode:78759 | |
ShippingCountry:USA | |
ShippingTimeZone:CST |
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 SitePostRequest | |
{ | |
public int DatabaseIdentifier { get; set; } | |
[Required] | |
public string SiteId { get; set; } | |
[Required] | |
public string Name { get; set; } | |
public Address Primary { get; set; } | |
public Address Billing { get; set; } | |
public Address Shipping { get; set; } | |
[BasedOnList(ListNames.SiteType)] | |
public string Type { get; set; } | |
[BasedOnList(ListNames.SiteStatus)] | |
public string Status { get; set; } | |
public string Phone { get; set; } | |
public string Fax { get; set; } | |
public string Region { get; set; } | |
public string District { 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 class Address : DomainEntity, ITemplateMarker | |
{ | |
public string Address1 { get; set; } | |
public string Address2 { get; set; } | |
public string City { get; set; } | |
public string PostalCode { get; set; } | |
[Required, BasedOnList(StateListSourcePolicy.StateListName)] | |
public string StateOrProvince { get; set; } | |
[Required, BasedOnList(CountryListSourcePolicy.CountryListName)] | |
public string Country { get; set; } | |
[Required, BasedOnList(TimezoneListSourcePolicy.TimezoneByCountryListName)] | |
public string TimeZone { get; set; } | |
public string FullTimeZoneName { get; set; } | |
private sealed class AddressEqualityComparer : IEqualityComparer<Address> | |
{ | |
public bool Equals(Address x, Address y) | |
{ | |
if (ReferenceEquals(x, y)) return true; | |
if (ReferenceEquals(x, null)) return false; | |
if (ReferenceEquals(y, null)) return false; | |
if (x.GetType() != y.GetType()) return false; | |
return string.Equals(x.Address1, y.Address1) && string.Equals(x.Address2, y.Address2) && string.Equals(x.City, y.City) && string.Equals(x.PostalCode, y.PostalCode) && string.Equals(x.StateOrProvince, y.StateOrProvince) && string.Equals(x.Country, y.Country) && string.Equals(x.TimeZone, y.TimeZone); | |
} | |
public int GetHashCode(Address obj) | |
{ | |
unchecked | |
{ | |
int hashCode = (obj.Address1 != null ? obj.Address1.GetHashCode() : 0); | |
hashCode = (hashCode*397) ^ (obj.Address2 != null ? obj.Address2.GetHashCode() : 0); | |
hashCode = (hashCode*397) ^ (obj.City != null ? obj.City.GetHashCode() : 0); | |
hashCode = (hashCode*397) ^ (obj.PostalCode != null ? obj.PostalCode.GetHashCode() : 0); | |
hashCode = (hashCode*397) ^ obj.StateOrProvince.GetHashCode(); | |
hashCode = (hashCode*397) ^ obj.Country.GetHashCode(); | |
hashCode = (hashCode*397) ^ obj.TimeZone.GetHashCode(); | |
return hashCode; | |
} | |
} | |
} | |
private static readonly IEqualityComparer<Address> AddressComparerInstance = new AddressEqualityComparer(); | |
public static IEqualityComparer<Address> AddressComparer | |
{ | |
get { return AddressComparerInstance; } | |
} | |
} |
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
** Local | |
* Bottles Version: 1.0.0.443, IsPreRelease: False | |
* Castle.Core Version: 3.0.0.4001, IsPreRelease: False | |
* Dovetail.SDK Version: 3.2.10.8, IsPreRelease: False | |
* Dovetail.SDK.Bootstrap Version: 0.5.2.51047, IsPreRelease: False | |
* Dovetail.SDK.Fubu Version: 0.5.2.51047, IsPreRelease: False | |
* Dovetail.SDK.ModelMap Version: 0.5.2.51047, IsPreRelease: False | |
* FubuCore Version: 1.0.0.225, IsPreRelease: False | |
* FubuLocalization Version: 0.9.5.126, IsPreRelease: False | |
* FubuMVC.Core Version: 1.0.1.1410, IsPreRelease: False | |
* FubuMVC.Core.Assets Version: 0.9.9.325, IsPreRelease: False | |
* FubuMVC.Core.UI Version: 1.0.1.351, IsPreRelease: False | |
* FubuMVC.Core.View Version: 1.0.0.383, IsPreRelease: False | |
* FubuMVC.Diagnostics Version: 0.9.6.215, IsPreRelease: False | |
* FubuMVC.JQueryUI Version: 0.5.0.226, IsPreRelease: False | |
* FubuMVC.Katana Version: 1.1.0.1534, IsPreRelease: False | |
* FubuMVC.Localization Version: 0.1.0.151, IsPreRelease: False | |
* FubuMVC.Media Version: 0.9.5.318, IsPreRelease: False | |
* FubuMVC.Navigation Version: 0.9.0.88, IsPreRelease: False | |
* FubuMVC.OwinHost Version: 1.1.0.1534, IsPreRelease: False | |
* FubuMVC.References Version: 1.0.0.180, IsPreRelease: False | |
* FubuMVC.SlickGrid Version: 0.0.0.435, IsPreRelease: False | |
* FubuMVC.Spark Version: 1.0.0.383, IsPreRelease: False | |
* FubuMVC.StructureMap Version: 1.0.1.1410, IsPreRelease: False | |
* FubuMVC.TwitterBootstrap Version: 0.0.0.433, IsPreRelease: False | |
* FubuMVC.Validation Version: 0.9.10.709, IsPreRelease: False | |
* FubuTestingSupport Version: 1.0.0.225, IsPreRelease: False | |
* FubuValidation Version: 0.9.10.709, IsPreRelease: False | |
* HtmlTags Version: 1.2.0.150, IsPreRelease: False | |
* log4net Version: 2.0.0.0, IsPreRelease: False | |
* Microsoft.AspNet.WebApi.Client Version: 4.0.20710.0, IsPreRelease: False | |
* Microsoft.AspNet.WebApi.Core Version: 4.0.20710.0, IsPreRelease: False | |
* Microsoft.AspNet.WebApi.SelfHost Version: 4.0.30506.0, IsPreRelease: False | |
* Microsoft.Net.Http Version: 2.0.20710.0, IsPreRelease: False | |
* Newtonsoft.Json Version: 4.5.11.0, IsPreRelease: False | |
* NUnit Version: 2.6.2.0, IsPreRelease: False | |
* NUnit.Runners Version: 2.6.2.0, IsPreRelease: False | |
* Owin Version: 1.0.0.0, IsPreRelease: False | |
* Owin.Extensions Version: 0.8.5.0, IsPreRelease: False | |
* Owin.Types Version: 0.8.5.0, IsPreRelease: False | |
* RhinoMocks Version: 3.6.1.0, IsPreRelease: False | |
* Selenium.RC Version: 2.33.0.0, IsPreRelease: False | |
* Selenium.Support Version: 2.33.0.0, IsPreRelease: False | |
* Selenium.WebDriver Version: 2.33.0.0, IsPreRelease: False | |
* Selenium.WebDriverBackedSelenium Version: 2.33.0.0, IsPreRelease: False | |
* Serenity Version: 0.9.8.186, IsPreRelease: False | |
* Spark Version: 1.7.5.1, IsPreRelease: False | |
* Storyteller2 Version: 2.0.0.21, IsPreRelease: False | |
* structuremap Version: 2.6.3.0, IsPreRelease: False | |
* structuremap.automocking Version: 2.6.3.0, IsPreRelease: False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fubu Diagnostics showing the request bindings:
http://cl.ly/image/2n0H341X303w/Image%202013-07-24%20at%204.54.20%20PM.png