public virtual void Patch(StoreEntity target) { if (target == null) { throw new ArgumentNullException(nameof(target)); } target.AdminEmail = AdminEmail; target.Catalog = Catalog; target.Country = Country; target.DefaultCurrency = DefaultCurrency; target.DefaultLanguage = DefaultLanguage; target.Description = Description; target.DisplayOutOfStock = DisplayOutOfStock; target.Email = Email; target.ModifiedBy = ModifiedBy; target.ModifiedDate = ModifiedDate; target.Name = Name; target.Region = Region; target.SecureUrl = SecureUrl; target.TimeZone = TimeZone; target.Url = Url; target.StoreState = StoreState; target.FulfillmentCenterId = FulfillmentCenterId; target.ReturnsFulfillmentCenterId = ReturnsFulfillmentCenterId; if (!Languages.IsNullCollection()) { var languageComparer = AnonymousComparer.Create((StoreLanguageEntity x) => x.LanguageCode); Languages.Patch(target.Languages, languageComparer, (sourceLang, targetLang) => targetLang.LanguageCode = sourceLang.LanguageCode); } if (!Currencies.IsNullCollection()) { var currencyComparer = AnonymousComparer.Create((StoreCurrencyEntity x) => x.CurrencyCode); Currencies.Patch(target.Currencies, currencyComparer, (sourceCurrency, targetCurrency) => targetCurrency.CurrencyCode = sourceCurrency.CurrencyCode); } if (!TrustedGroups.IsNullCollection()) { var trustedGroupComparer = AnonymousComparer.Create((StoreTrustedGroupEntity x) => x.GroupName); TrustedGroups.Patch(target.TrustedGroups, trustedGroupComparer, (sourceGroup, targetGroup) => sourceGroup.GroupName = targetGroup.GroupName); } if (!FulfillmentCenters.IsNullCollection()) { var fulfillmentCenterComparer = AnonymousComparer.Create((StoreFulfillmentCenterEntity fc) => $"{fc.FulfillmentCenterId}-{fc.Type}"); FulfillmentCenters.Patch(target.FulfillmentCenters, fulfillmentCenterComparer, (sourceFulfillmentCenter, targetFulfillmentCenter) => sourceFulfillmentCenter.Patch(targetFulfillmentCenter)); } if (!SeoInfos.IsNullCollection()) { SeoInfos.Patch(target.SeoInfos, (sourceSeoInfo, targetSeoInfo) => sourceSeoInfo.Patch(targetSeoInfo)); } }
public virtual void Patch(StoreEntity target) { if (target == null) { throw new ArgumentNullException("target"); } target.AdminEmail = this.AdminEmail; target.Catalog = this.Catalog; target.Country = this.Country; target.DefaultCurrency = this.DefaultCurrency; target.DefaultLanguage = this.DefaultLanguage; target.Description = this.Description; target.DisplayOutOfStock = this.DisplayOutOfStock; target.Email = this.Email; target.ModifiedBy = this.ModifiedBy; target.ModifiedDate = this.ModifiedDate; target.Name = this.Name; target.Region = this.Region; target.SecureUrl = this.SecureUrl; target.TimeZone = this.TimeZone; target.Url = this.Url; target.StoreState = (int)this.StoreState; target.FulfillmentCenterId = this.FulfillmentCenterId; target.ReturnsFulfillmentCenterId = this.ReturnsFulfillmentCenterId; if (!this.Languages.IsNullCollection()) { var languageComparer = AnonymousComparer.Create((StoreLanguageEntity x) => x.LanguageCode); this.Languages.Patch(target.Languages, languageComparer, (sourceLang, targetLang) => targetLang.LanguageCode = sourceLang.LanguageCode); } if (!this.Currencies.IsNullCollection()) { var currencyComparer = AnonymousComparer.Create((StoreCurrencyEntity x) => x.CurrencyCode); this.Currencies.Patch(target.Currencies, currencyComparer, (sourceCurrency, targetCurrency) => targetCurrency.CurrencyCode = sourceCurrency.CurrencyCode); } if (!this.TrustedGroups.IsNullCollection()) { var trustedGroupComparer = AnonymousComparer.Create((StoreTrustedGroupEntity x) => x.GroupName); this.TrustedGroups.Patch(target.TrustedGroups, trustedGroupComparer, (sourceGroup, targetGroup) => sourceGroup.GroupName = targetGroup.GroupName); } if (!this.PaymentMethods.IsNullCollection()) { var paymentComparer = AnonymousComparer.Create((StorePaymentMethodEntity x) => x.Code); this.PaymentMethods.Patch(target.PaymentMethods, paymentComparer, (sourceMethod, targetMethod) => sourceMethod.Patch(targetMethod)); } if (!this.ShippingMethods.IsNullCollection()) { var shippingComparer = AnonymousComparer.Create((StoreShippingMethodEntity x) => x.Code); this.ShippingMethods.Patch(target.ShippingMethods, shippingComparer, (sourceMethod, targetMethod) => sourceMethod.Patch(targetMethod)); } if (!this.TaxProviders.IsNullCollection()) { var shippingComparer = AnonymousComparer.Create((StoreTaxProviderEntity x) => x.Code); this.TaxProviders.Patch(target.TaxProviders, shippingComparer, (sourceProvider, targetProvider) => sourceProvider.Patch(targetProvider)); } if (!this.FulfillmentCenters.IsNullCollection()) { var fulfillmentCenterComparer = AnonymousComparer.Create((StoreFulfillmentCenterEntity fc) => $"{fc.FulfillmentCenterId}-{fc.Type}"); this.FulfillmentCenters.Patch(target.FulfillmentCenters, fulfillmentCenterComparer, (sourceFulfillmentCenter, targetFulfillmentCenter) => sourceFulfillmentCenter.Patch(targetFulfillmentCenter)); } }