public void Explicit_setting_for_collection_should_not_be_replaced_by_conventions( string propertyName, StoreAs asExpected) { // given var mapping = MappingsRepository.MappingFor <IEntityWithCollections>(); // when var property = (ICollectionMapping)mapping.PropertyFor(propertyName); // then property.StoreAs.Should().Be(asExpected); }
public void Default_setting_for_collection_should_be_replaced_by_conventions( string propertyName, StoreAs asExpected) { // given var mapping = MappingsRepository.MappingFor<IEntityWithCollections>(); // when var property = (ICollectionMapping)mapping.PropertyFor(propertyName); // then property.StoreAs.Should().Be(asExpected); }
internal static TItem[] Set <TItem>(this NCacheWrapper cache, object[] keys, TItem[] values, CachingOptions options, Alachisoft.NCache.Runtime.Dependencies.CacheDependency dbDependency, StoreAs storingAs) { Logger.Log( "Setting items in bulk against respective keys with DbDependency '" + dbDependency + "'.", Microsoft.Extensions.Logging.LogLevel.Trace ); Alachisoft.NCache.Web.Caching.CacheItem[] cacheItems = new Alachisoft.NCache.Web.Caching.CacheItem[values.Count()]; for (int i = 0; i < values.Count(); i++) { cacheItems[i] = new Alachisoft.NCache.Web.Caching.CacheItem(values[i]); CachingOptionsUtil.CopyMetadata(ref cacheItems[i], options, dbDependency); } if (keys.Length > 0) { cache.InsertBulk(keys, cacheItems); } return(values); }
internal static TItem Set <TItem>(this NCacheWrapper cache, object key, TItem value, CachingOptions options, Alachisoft.NCache.Runtime.Dependencies.CacheDependency dbDependency, StoreAs storingAs) { Logger.Log( "Setting item '" + value + "' against key '" + key + "' with DbDependency '" + dbDependency + "'.", Microsoft.Extensions.Logging.LogLevel.Trace ); Alachisoft.NCache.Web.Caching.CacheItem cacheItem = new Alachisoft.NCache.Web.Caching.CacheItem(value); CachingOptionsUtil.CopyMetadata(ref cacheItem, options, dbDependency); cache.Insert(key, cacheItem); return(value); }
internal static List <TItem> Set <TItem>(this NCacheWrapper cache, object key, Dictionary <string, TItem> value, CachingOptions options, Alachisoft.NCache.Runtime.Dependencies.CacheDependency dbDependency, StoreAs storingAs) { Logger.Log( "About to set values with options " + options.ToLog() + ", DbDependency '" + dbDependency + "' and StoringAs '" + storingAs + "'.", Microsoft.Extensions.Logging.LogLevel.Trace ); // Add entities if stroing as seperateEntities if (storingAs == StoreAs.SeperateEntities) { Logger.Log("Values are about to be set as separate entities.", Microsoft.Extensions.Logging.LogLevel.Trace); cache.Set(value.Keys.ToArray(), value.Values.ToArray(), options, dbDependency, storingAs); } // from here onwards is the enumerator logic and now it is being done in "else" after we have moved to tags based result set regeneration else { Logger.Log("Values are about to be set as collection.", Microsoft.Extensions.Logging.LogLevel.Trace); // Add query enumerator CacheEntry entry = cache.CreateEntry(key); // Setting options if (options != null) { entry.SetOptions(options); } // Setting Value if (storingAs == StoreAs.Collection) { entry.Value = value.Values.ToList(); } // Mind that this is not the user specified option but the end storing methodology entry.StoredAs = storingAs; // Set dependencies in the entry var aggregateDependency = new AggregateCacheDependency(); if (dbDependency != null) { aggregateDependency.Add(dbDependency); } entry.Dependencies = aggregateDependency; cache.Set(key, entry, options, dbDependency, storingAs); } return(value.Values.ToList()); }
/// <summary>Initializes a new instance of the <see cref="CollectionMappingProvider" /> class.</summary> /// <param name="propertyMapping">The property mapping.</param> /// <param name="storeAs">The storage strategy.</param> public CollectionMappingProvider(IPropertyMappingProvider propertyMapping, StoreAs storeAs) { _propertyMapping = propertyMapping; ((ICollectionMappingProvider)this).StoreAs = storeAs; }
public StoreSettingsAttribute(StoreAs dateTime = StoreAs.Default) { this.DateTime = dateTime; }
public CollectionMapping(Type declaringType, Type returnType, string name, Uri predicateUri, StoreAs storageStrategy) : base(declaringType, returnType, name, predicateUri) { StoreAs = storageStrategy; }
private Mock <ICollectionMappingProvider> MakeCollectionMappingProvider(string propertyName, Type converterType, StoreAs storeAs = default(StoreAs), Type elementConverterType = null) { var result = new Mock <ICollectionMappingProvider>(); result.SetupGet(instance => instance.PropertyInfo).Returns(typeof(TestPropertyInfo).GetProperty(propertyName)); result.SetupGet(instance => instance.ConverterType).Returns(converterType); result.SetupSet(instance => instance.ConverterType = It.IsAny <Type>()); result.SetupGet(instance => instance.StoreAs).Returns(storeAs); result.SetupSet(instance => instance.StoreAs = It.IsAny <StoreAs>()); result.SetupGet(instance => instance.ElementConverterType).Returns(elementConverterType); result.SetupSet(instance => instance.ElementConverterType = It.IsAny <Type>()); return(result); }