├── .gitattributes ├── Quarks.Tests ├── InflectorTests.cs ├── FluentNHibernate │ ├── Conventions │ │ ├── Property │ │ │ ├── LessThan8000Bytes.jpg │ │ │ └── MoreThan8000Bytes.jpg │ │ └── Hibernate │ │ │ └── NotAutoImportTests.cs │ └── FilterableTypeSourceTests.cs ├── app.config ├── ObjectExtensions │ └── ChangeTypeToTests.cs ├── PluralizeForCountTests.cs ├── UncapitalizeTests.cs ├── TitleizeTests.cs ├── UnderscoreTests.cs ├── DasherizeTests.cs ├── HumanizeTests.cs ├── CapitalizeTests.cs ├── EnumExtensions │ └── GetAttributeOfTypeTests.cs ├── packages.config ├── IEnumerableExtensions │ └── PartitionTests.cs ├── PascalizeAndCamelizeTests.cs ├── OrdinalizeTests.cs └── TypeExtensions │ └── InvokeGenericMethodTests.cs ├── Quarks.png ├── Quarks ├── IEntity.cs ├── GenericExtensions │ ├── IsEqualToDefault.cs │ ├── QuasiEquals.cs │ ├── IsEqualToDefault.nuspec │ └── QuasiEquals.nuspec ├── AssemblyExtensions │ ├── GetVersion.cs │ ├── GetExecutionFolder.cs │ ├── GetIsDebugBuild.cs │ ├── GetVersion.nuspec │ ├── GetIsDebugBuild.nuspec │ └── GetExecutionFolder.nuspec ├── TypeExtensions │ ├── IsNullable.cs │ ├── IsNullable.nuspec │ ├── InvokeGenericMethod.nuspec │ └── InheritsOrImplements.nuspec ├── NHibernate │ ├── ISessionExtensions │ │ ├── ConfigureAsReadOnly.cs │ │ ├── Transactionally.cs │ │ ├── Transactionally.nuspec │ │ └── ConfigureAsReadOnly.nuspec │ ├── ISessionFactoryExtensions │ │ ├── GetCurrentOrNewSession.cs │ │ ├── HasCurrentSessionContext.cs │ │ ├── GetCurrentOrNewSession.nuspec │ │ └── HasCurrentSessionContext.nuspec │ ├── UserTypes │ │ ├── UShortType.cs │ │ ├── ByteType.cs │ │ ├── ImmutableUserTypeBase.nuspec │ │ ├── UIntType.cs │ │ ├── ImmutableCompositeUserTypeBase.nuspec │ │ ├── ByteType.nuspec │ │ ├── UIntType.nuspec │ │ ├── UShortType.nuspec │ │ ├── EnumerableOfStringType.nuspec │ │ ├── NullableTimeType.nuspec │ │ ├── NullableTimeType.cs │ │ └── EnumerableOfStringType.cs │ ├── SqliteInMemoryDriverConnectionProvider.cs │ ├── SqliteRemapper.nuspec │ ├── SqlTaggingInterceptor.nuspec │ └── SqliteInMemoryDriverConnectionProvider.nuspec ├── FluentNHibernate │ ├── Conventions │ │ ├── Class │ │ │ ├── DynamicInsert.cs │ │ │ ├── DynamicUpdate.cs │ │ │ ├── CacheReadWrite.cs │ │ │ ├── SchemaDbo.cs │ │ │ ├── Table.cs │ │ │ ├── SchemaDbo.nuspec │ │ │ ├── NotLazyLoad.nuspec │ │ │ ├── DynamicInsert.nuspec │ │ │ ├── DynamicUpdate.nuspec │ │ │ ├── CacheReadWrite.nuspec │ │ │ ├── Table.nuspec │ │ │ └── NotLazyLoad.cs │ │ ├── HasMany │ │ │ ├── BatchSize100.cs │ │ │ ├── NotKeyUpdate.cs │ │ │ ├── NotLazyLoad.cs │ │ │ ├── NotKeyNullable.cs │ │ │ ├── NotLazyLoad.nuspec │ │ │ ├── BatchSize100.nuspec │ │ │ ├── NotKeyUpdate.nuspec │ │ │ ├── NotKeyNullable.nuspec │ │ │ └── KeyColumn.cs │ │ ├── Hibernate │ │ │ ├── NotAutoImport.cs │ │ │ └── NotAutoImport.nuspec │ │ ├── GetTableName.cs │ │ ├── HasOne │ │ │ ├── FetchJoin.cs │ │ │ ├── NotLazyLoad.cs │ │ │ ├── FetchJoin.nuspec │ │ │ ├── CascadeAll.cs │ │ │ ├── CascadeAll.nuspec │ │ │ ├── Constrained.nuspec │ │ │ ├── NotLazyLoad.nuspec │ │ │ └── Constrained.cs │ │ ├── EscapeColumnName.cs │ │ ├── Reference │ │ │ ├── NotLazyLoad.cs │ │ │ ├── FetchJoin.cs │ │ │ ├── NotNullable.cs │ │ │ ├── FetchJoin.nuspec │ │ │ ├── ForeignKey.cs │ │ │ ├── NotLazyLoad.nuspec │ │ │ ├── NotNullable.nuspec │ │ │ ├── ForeignKey.nuspec │ │ │ └── Column.cs │ │ ├── AbbreviationAttribute.cs │ │ ├── UserType │ │ │ ├── CustomTypeByteType.cs │ │ │ ├── CustomTypeUIntType.cs │ │ │ ├── CustomTypeUShortType.cs │ │ │ ├── CustomTypeNullableTimeType.cs │ │ │ ├── CustomTypeEnumerableOfStringType.cs │ │ │ ├── CustomSqlTypeEnum.cs │ │ │ ├── CustomTypeEnum.cs │ │ │ ├── CustomSqlTypeEnum.nuspec │ │ │ ├── CustomTypeEnum.nuspec │ │ │ ├── CustomTypeByteType.nuspec │ │ │ ├── CustomTypeUIntType.nuspec │ │ │ ├── CustomTypeUShortType.nuspec │ │ │ ├── CustomTypeNullableTimeType.nuspec │ │ │ └── CustomTypeEnumerableOfStringType.nuspec │ │ ├── Id │ │ │ ├── GeneratedByAssigned.cs │ │ │ ├── GeneratedByNative.nuspec │ │ │ ├── Column.cs │ │ │ ├── GeneratedByAssigned.nuspec │ │ │ ├── GeneratedByNative.cs │ │ │ └── Column.nuspec │ │ ├── Property │ │ │ ├── NotNullable.cs │ │ │ ├── StringLength.cs │ │ │ ├── Column.cs │ │ │ ├── NotNullable.nuspec │ │ │ ├── StringLength.nuspec │ │ │ ├── CustomTypeBinaryBlob.nuspec │ │ │ └── Column.nuspec │ │ ├── GetTableName.nuspec │ │ ├── EscapeColumnName.nuspec │ │ ├── Version │ │ │ ├── NhVersioned.nuspec │ │ │ ├── MssqlVersioned.nuspec │ │ │ └── NhVersioned.cs │ │ ├── AbbreviationAttribute.nuspec │ │ └── Proxy │ │ │ └── EntityInterface.nuspec │ └── FilterableTypeSource.nuspec ├── StringExtensions │ ├── Contains.cs │ └── Contains.nuspec ├── IDictionaryExtensions │ ├── AddOrUpdate.cs │ ├── AddOrUpdate.nuspec │ ├── GetValueOrDefault.nuspec │ └── GetValueOrDefault.cs ├── app.config ├── AppSettings.cs ├── ObjectExtensions │ ├── Flatten.cs │ ├── CanBeRepresentedAsString.cs │ ├── ToEnumerable.cs │ ├── CanBeRepresentedAsString.nuspec │ ├── ToEnumerable.nuspec │ ├── ChangeTypeTo.nuspec │ └── Flatten.nuspec ├── IEnumerableExtensions │ ├── Contains.cs │ ├── Contains.nuspec │ ├── ForEach.nuspec │ ├── Partition.nuspec │ └── OrderBy.nuspec ├── NameValueCollectionExtensions │ ├── ToDictionary.cs │ └── ToDictionary.nuspec ├── Machine.Fakes │ ├── AutoMapper │ │ ├── TypeConverterContext.cs │ │ ├── ValueResolverContext.cs │ │ ├── MappingContext.nuspec │ │ ├── TypeConverterContext.nuspec │ │ └── ValueResolverContext.nuspec │ ├── System.Web.Mvc │ │ ├── ConfigForAnAjaxRequest.cs │ │ ├── ConfigForAnHttpRequest.cs │ │ ├── ConfigForAFakeUserAgent.cs │ │ ├── ConfigForAnAjaxRequest.nuspec │ │ ├── ConfigForAnHttpRequest.nuspec │ │ ├── ConfigForAFakeUserAgent.nuspec │ │ ├── FakeUrlHelper.nuspec │ │ ├── FakeRequestContext.nuspec │ │ ├── FakeUrlHelper.cs │ │ └── ConfigForAFakeUrlHelper.nuspec │ ├── ConfigForASystemTimeOf.cs │ └── ConfigForASystemTimeOf.nuspec ├── DiagnosticsTextWriter.cs ├── .Tasks.ps1 ├── SystemTimeOffset.cs ├── System.Web │ ├── FakeHttpResponse.cs │ └── FakeHttpResponse.nuspec ├── SystemTime.cs ├── EnumExtensions │ ├── GetAttributeOfType.cs │ └── GetAttributeOfType.nuspec ├── FileStore.nuspec ├── IEntity.nuspec ├── Feature.nuspec ├── DynamicDictionary.nuspec ├── SystemTime.nuspec ├── Disposable.nuspec ├── DiagnosticsTextWriter.nuspec ├── MemberName.nuspec ├── TestRetrier.nuspec ├── AppSettings.nuspec ├── ExpressionVisitors │ ├── ParameterRebinderVisitor.cs │ ├── ParameterRebinderVisitor.nuspec │ └── MemberAccessPathVisitor.nuspec ├── SystemTimeOffset.nuspec ├── Page.nuspec ├── SentenceSplitAndJoinExtension.nuspec ├── Retrier.nuspec ├── ApplicationAssembly.cs ├── AttributeHelper.nuspec ├── ApplicationAssembly.nuspec ├── Switch.nuspec ├── Inflector.nuspec ├── IdentityFieldProvider.nuspec ├── ExpressionExtensions │ └── Compose.nuspec ├── Feature.cs ├── AssertComparer.nuspec └── EntityFramework │ └── Conventions │ └── StoreModel │ └── RemoveUnderscoreFromDefaultForeignKeyNames.nuspec ├── pt.bat └── LICENSE /.gitattributes: -------------------------------------------------------------------------------- 1 | * -text -------------------------------------------------------------------------------- /Quarks.Tests/InflectorTests.cs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Quarks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaynevanasperen/Quarks/HEAD/Quarks.png -------------------------------------------------------------------------------- /Quarks/IEntity.cs: -------------------------------------------------------------------------------- 1 | namespace Quarks 2 | { 3 | public interface IEntity 4 | { 5 | object Id { get; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Quarks.Tests/FluentNHibernate/Conventions/Property/LessThan8000Bytes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaynevanasperen/Quarks/HEAD/Quarks.Tests/FluentNHibernate/Conventions/Property/LessThan8000Bytes.jpg -------------------------------------------------------------------------------- /Quarks.Tests/FluentNHibernate/Conventions/Property/MoreThan8000Bytes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shaynevanasperen/Quarks/HEAD/Quarks.Tests/FluentNHibernate/Conventions/Property/MoreThan8000Bytes.jpg -------------------------------------------------------------------------------- /Quarks/GenericExtensions/IsEqualToDefault.cs: -------------------------------------------------------------------------------- 1 | namespace Quarks.GenericExtensions 2 | { 3 | static partial class GenericExtension 4 | { 5 | internal static bool IsEqualToDefault(this T obj) 6 | { 7 | return Equals(obj, default(T)); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Quarks/GenericExtensions/QuasiEquals.cs: -------------------------------------------------------------------------------- 1 | namespace Quarks.GenericExtensions 2 | { 3 | static partial class GenericExtension 4 | { 5 | internal static bool QuasiEquals(this T x, T y) 6 | { 7 | return new AssertComparer().Equals(x, y); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Quarks/AssemblyExtensions/GetVersion.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | 3 | namespace Quarks.AssemblyExtensions 4 | { 5 | static partial class AssemblyExtension 6 | { 7 | internal static string GetVersion(this Assembly assembly) 8 | { 9 | return assembly.GetName().Version.ToString(3); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Quarks/TypeExtensions/IsNullable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Quarks.TypeExtensions 4 | { 5 | static partial class TypeExtension 6 | { 7 | internal static bool IsNullable(this Type type) 8 | { 9 | return type.GetGenericTypeDefinition().IsAssignableFrom(typeof(Nullable<>)); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Quarks/NHibernate/ISessionExtensions/ConfigureAsReadOnly.cs: -------------------------------------------------------------------------------- 1 | using NHibernate; 2 | 3 | namespace Quarks.NHibernate.ISessionExtensions 4 | { 5 | static partial class SessionExtension 6 | { 7 | internal static void ConfigureAsReadOnly(this ISession session) 8 | { 9 | session.DefaultReadOnly = true; 10 | session.FlushMode = FlushMode.Never; 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Class/DynamicInsert.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.Instances; 3 | 4 | namespace Quarks.FluentNHibernate.Conventions.Class 5 | { 6 | class DynamicInsert : IClassConvention 7 | { 8 | public void Apply(IClassInstance instance) 9 | { 10 | instance.DynamicInsert(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Class/DynamicUpdate.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.Instances; 3 | 4 | namespace Quarks.FluentNHibernate.Conventions.Class 5 | { 6 | class DynamicUpdate : IClassConvention 7 | { 8 | public void Apply(IClassInstance instance) 9 | { 10 | instance.DynamicUpdate(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Class/CacheReadWrite.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.Instances; 3 | 4 | namespace Quarks.FluentNHibernate.Conventions.Class 5 | { 6 | class EntityCacheConvention : IClassConvention 7 | { 8 | public void Apply(IClassInstance instance) 9 | { 10 | instance.Cache.ReadWrite(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasMany/BatchSize100.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.Instances; 3 | 4 | namespace Quarks.FluentNHibernate.Conventions.HasMany 5 | { 6 | class BatchSize100 : IHasManyConvention 7 | { 8 | public void Apply(IOneToManyCollectionInstance instance) 9 | { 10 | instance.BatchSize(100); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasMany/NotKeyUpdate.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.Instances; 3 | 4 | namespace Quarks.FluentNHibernate.Conventions.HasMany 5 | { 6 | class NotKeyUpdate : IHasManyConvention 7 | { 8 | public void Apply(IOneToManyCollectionInstance instance) 9 | { 10 | instance.Not.KeyUpdate(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Quarks/StringExtensions/Contains.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Quarks.StringExtensions 4 | { 5 | static partial class StringExtension 6 | { 7 | internal static bool Contains(this string input, string value, bool caseSensitive) 8 | { 9 | if (caseSensitive) 10 | return input.Contains(value); 11 | 12 | return input.IndexOf(value, StringComparison.CurrentCultureIgnoreCase) != -1; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /Quarks/IDictionaryExtensions/AddOrUpdate.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Quarks.IDictionaryExtensions 4 | { 5 | static partial class DictionaryExtension 6 | { 7 | internal static void AddOrUpdate(this IDictionary dictionary, TKey key, TValue value) 8 | { 9 | if (dictionary.ContainsKey(key)) 10 | dictionary[key] = value; 11 | else 12 | dictionary.Add(key, value); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Quarks/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Quarks/AssemblyExtensions/GetExecutionFolder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Reflection; 4 | 5 | namespace Quarks.AssemblyExtensions 6 | { 7 | static partial class AssemblyExtension 8 | { 9 | internal static string GetExecutionFolder(this Assembly assembly) 10 | { 11 | var uri = new UriBuilder(assembly.CodeBase); 12 | var path = Uri.UnescapeDataString(uri.Path); 13 | return Path.GetDirectoryName(path); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Quarks.Tests/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Quarks/AppSettings.cs: -------------------------------------------------------------------------------- 1 | using System.Configuration; 2 | 3 | namespace Quarks 4 | { 5 | /// 6 | /// Provides a wrapper around ConfigurationManager.AppSettings to allow dependency injections 7 | /// 8 | public interface IAppSettings 9 | { 10 | string Get(string key); 11 | } 12 | 13 | public class AppSettings : IAppSettings 14 | { 15 | public string Get(string key) 16 | { 17 | return ConfigurationManager.AppSettings[key]; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Hibernate/NotAutoImport.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.Instances; 3 | 4 | namespace Quarks.FluentNHibernate.Conventions.Hibernate 5 | { 6 | class NotAutoImport : IHibernateMappingConvention 7 | { 8 | public void Apply(IHibernateMappingInstance instance) 9 | { 10 | instance.Not.AutoImport(); // Required in order to have entity classes with same name under different namespaces 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/GetTableName.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Quarks.FluentNHibernate.Conventions 4 | { 5 | static partial class TypeExtension 6 | { 7 | internal static string GetTableName(this Type entityType) 8 | { 9 | // Remove "I" prefix from Interface names 10 | var entity = (entityType.IsInterface && entityType.Name.StartsWith("I")) 11 | ? entityType.Name.Substring(1) 12 | : entityType.Name; 13 | 14 | return entity; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasOne/FetchJoin.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.Instances; 3 | 4 | namespace Quarks.FluentNHibernate.Conventions.HasOne 5 | { 6 | /// 7 | /// All one-to-one references, unless explicitly specified, use Fetch.Join(). 8 | /// 9 | class FetchJoin : IHasOneConvention 10 | { 11 | public void Apply(IOneToOneInstance instance) 12 | { 13 | instance.Fetch.Join(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Quarks/ObjectExtensions/Flatten.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace Quarks.ObjectExtensions 5 | { 6 | static partial class ObjectExtension 7 | { 8 | internal static IEnumerable Flatten(this object source) 9 | { 10 | if (source.CanBeRepresentedAsString()) 11 | yield return source; 12 | else 13 | foreach (var flattened in source.ToEnumerable().SelectMany(Flatten)) 14 | yield return flattened; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/EscapeColumnName.cs: -------------------------------------------------------------------------------- 1 | namespace Quarks.FluentNHibernate.Conventions 2 | { 3 | static partial class StringExtension 4 | { 5 | public const char EscapeCharacter = '`'; 6 | /// 7 | /// Return the standard column name convention for the given property name. 8 | /// 9 | internal static string EscapeColumnName(this string columnName) 10 | { 11 | return string.Format("{1}{0}{1}", columnName, EscapeCharacter); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Quarks/ObjectExtensions/CanBeRepresentedAsString.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace Quarks.ObjectExtensions 5 | { 6 | static partial class ObjectExtension 7 | { 8 | internal static bool CanBeRepresentedAsString(this object source) 9 | { 10 | return source == null || 11 | source is string || 12 | source is Enum || 13 | source is DateTime || 14 | source.GetType().IsPrimitive || 15 | !source.GetType().GetProperties().Any(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasOne/NotLazyLoad.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.Instances; 3 | 4 | namespace Quarks.FluentNHibernate.Conventions.HasOne 5 | { 6 | /// 7 | /// All one-to-one references, unless explicitly specified, are NOT lazy loaded. 8 | /// 9 | class NotLazyLoad : IHasOneConvention 10 | { 11 | public void Apply(IOneToOneInstance instance) 12 | { 13 | instance.Not.LazyLoad(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Quarks.Tests/ObjectExtensions/ChangeTypeToTests.cs: -------------------------------------------------------------------------------- 1 | using Machine.Specifications; 2 | using Quarks.ObjectExtensions; 3 | 4 | namespace Quarks.Tests.ObjectExtensions 5 | { 6 | [Subject(typeof(ObjectExtension))] 7 | class When_using_change_type_to 8 | { 9 | It should_be_able_to_convert_a_long_to_a_nullable_int = () => 10 | { 11 | const long value = 2220; 12 | var result = value.ChangeTypeTo(); 13 | result.ShouldBeAssignableTo(); 14 | result.ShouldEqual(2220); 15 | }; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Reference/NotLazyLoad.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.Instances; 3 | 4 | namespace Quarks.FluentNHibernate.Conventions.Reference 5 | { 6 | /// 7 | /// All many-to-one references, unless explicitly specified, are NOT lazy loaded. 8 | /// 9 | class NotLazyLoad : IReferenceConvention 10 | { 11 | public void Apply(IManyToOneInstance instance) 12 | { 13 | instance.Not.LazyLoad(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasMany/NotLazyLoad.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.Instances; 3 | 4 | namespace Quarks.FluentNHibernate.Conventions.HasMany 5 | { 6 | /// 7 | /// All one-to-many references, unless explicitly specified, are NOT lazy loaded. 8 | /// 9 | class NotLazyLoad : IHasManyConvention 10 | { 11 | public void Apply(IOneToManyCollectionInstance instance) 12 | { 13 | instance.Not.LazyLoad(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Quarks/IEnumerableExtensions/Contains.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | 3 | namespace Quarks.IEnumerableExtensions 4 | { 5 | /// 6 | /// Extends the IEnumerable interface to include a Contains method. 7 | /// 8 | static partial class EnumerableExtension 9 | { 10 | internal static bool Contains(this IEnumerable collection, object item) 11 | { 12 | foreach (var element in collection) 13 | if (element.Equals(item)) 14 | return true; 15 | 16 | return false; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Quarks/NameValueCollectionExtensions/ToDictionary.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Collections.Specialized; 3 | using System.Linq; 4 | 5 | namespace Seatwave.Infrastructure.Utils 6 | { 7 | static partial class NameValueCollectionExtension 8 | { 9 | public static IDictionary ToDictionary(this NameValueCollection source) 10 | { 11 | return source.Cast() 12 | .Select(s => new { Key = s, Value = source[s] }) 13 | .ToDictionary(p => p.Key, p => (object)p.Value); 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/AutoMapper/TypeConverterContext.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using Machine.Fakes; 3 | using Machine.Specifications; 4 | 5 | namespace Quarks.Machine.Fakes.AutoMapper 6 | { 7 | public abstract class TypeConverterContext : WithSubject 8 | where TConverter : TypeConverter 9 | { 10 | Because of = () => 11 | Result = Subject.Convert(ResolutionContext.New(Source)); 12 | 13 | protected static TSource Source; 14 | protected static TResult Result; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Quarks/ObjectExtensions/ToEnumerable.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Reflection; 4 | 5 | namespace Quarks.ObjectExtensions 6 | { 7 | static partial class ObjectExtension 8 | { 9 | internal static IEnumerable ToEnumerable(this object source) 10 | { 11 | var sourceEnumerable = source as IEnumerable; 12 | return sourceEnumerable ?? source.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public).OrderBy(x => x.Name).Select(x => x.GetValue(source, null)); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Quarks.Tests/PluralizeForCountTests.cs: -------------------------------------------------------------------------------- 1 | using Machine.Specifications; 2 | 3 | namespace Quarks.Tests 4 | { 5 | [Subject(typeof(Inflector))] 6 | class When_using_pluralize_for_count 7 | { 8 | It should_pluralize_when_count_is_greater_than_two = () => 9 | "item".PluralizeForCount(2).ShouldEqual("items"); 10 | 11 | It should_pluralize_when_count_is_zero = () => 12 | "item".PluralizeForCount(0).ShouldEqual("items"); 13 | 14 | It should_not_pluralize_when_count_is_one = () => 15 | "item".PluralizeForCount(1).ShouldEqual("item"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Quarks/DiagnosticsTextWriter.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.IO; 3 | using System.Text; 4 | 5 | namespace Quarks 6 | { 7 | [DebuggerNonUserCode] 8 | class DiagnosticsTextWriter : TextWriter 9 | { 10 | public override void Write(char[] buffer, int index, int count) 11 | { 12 | Debug.Write(new string(buffer, index, count)); 13 | } 14 | 15 | public override void Write(string value) 16 | { 17 | Debug.Write(value); 18 | } 19 | 20 | public override Encoding Encoding 21 | { 22 | get { return Encoding.Default; } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/AutoMapper/ValueResolverContext.cs: -------------------------------------------------------------------------------- 1 | using AutoMapper; 2 | using Machine.Fakes; 3 | using Machine.Specifications; 4 | 5 | namespace Quarks.Machine.Fakes.AutoMapper 6 | { 7 | public abstract class ValueResolverContext : WithSubject 8 | where TResolver : ValueResolver 9 | { 10 | Because of = () => 11 | Result = (TResult)(Subject.Resolve(new ResolutionResult(ResolutionContext.New(Source))).Value); 12 | 13 | protected static TSource Source; 14 | protected static TResult Result; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/AbbreviationAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Remotion.Linq.Utilities; 3 | 4 | namespace Quarks.FluentNHibernate.Conventions 5 | { 6 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 7 | public class AbbreviationAttribute : Attribute 8 | { 9 | public AbbreviationAttribute(string abbreviation) 10 | { 11 | if (string.IsNullOrWhiteSpace(abbreviation)) throw new ArgumentEmptyException("abbreviation"); 12 | Abbreviation = abbreviation; 13 | } 14 | 15 | public string Abbreviation { get; private set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Quarks/.Tasks.ps1: -------------------------------------------------------------------------------- 1 | Include-PluginScripts 2 | 3 | function Pack-Nuspecs ($dateModified) { 4 | New-Item $artifactsPath -Type directory -Force | Out-Null 5 | $nuspecs = Get-ChildItem $basePath\$projectName\*.nuspec -Recurse 6 | if ($dateModified) { 7 | $nuspecs = $nuspecs | Where { $_.LastWriteTime -gt $dateModified } 8 | } 9 | $nuspecs | %{ exec { & NuGet pack $_.FullName -OutputDirectory $artifactsPath } } 10 | } 11 | 12 | task Pack { 13 | Pack-Nuspecs 14 | } 15 | 16 | task PackRecentlyModified { 17 | Pack-Nuspecs (Get-Date).AddDays(-1) 18 | } 19 | 20 | task . Clean, Compile, MSpec, PackRecentlyModified, Push -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/System.Web.Mvc/ConfigForAnAjaxRequest.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | using Machine.Fakes; 4 | 5 | namespace Quarks.Machine.Fakes.System.Web.Mvc 6 | { 7 | class ConfigForAnAjaxRequest 8 | { 9 | OnEstablish context = ctx => 10 | { 11 | var ajaxRequest = ctx.An(); 12 | ajaxRequest.WhenToldTo(x => x["X-Requested-With"]).Return("XMLHttpRequest"); 13 | var httpContext = ctx.An(); 14 | httpContext.WhenToldTo(x => x.Request).Return(ajaxRequest); 15 | ctx.Configure(new ControllerContext { HttpContext = httpContext }); 16 | }; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/System.Web.Mvc/ConfigForAnHttpRequest.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | using Machine.Fakes; 4 | 5 | namespace Quarks.Machine.Fakes.System.Web.Mvc 6 | { 7 | class ConfigForAnHttpRequest 8 | { 9 | OnEstablish context = ctx => 10 | { 11 | var httpRequest = ctx.An(); 12 | httpRequest.WhenToldTo(x => x["X-Requested-With"]).Return((string)null); 13 | var httpContext = ctx.An(); 14 | httpContext.WhenToldTo(x => x.Request).Return(httpRequest); 15 | ctx.Configure(new ControllerContext { HttpContext = httpContext }); 16 | }; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Class/SchemaDbo.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | 6 | namespace Quarks.FluentNHibernate.Conventions.Class 7 | { 8 | class SchemaDbo : IClassConvention, IClassConventionAcceptance 9 | { 10 | public void Apply(IClassInstance instance) 11 | { 12 | instance.Schema("dbo"); 13 | } 14 | 15 | public void Accept(IAcceptanceCriteria criteria) 16 | { 17 | criteria.Expect(x => string.IsNullOrEmpty(x.Schema)); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Quarks/AssemblyExtensions/GetIsDebugBuild.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.Linq; 3 | using System.Reflection; 4 | 5 | namespace Quarks.AssemblyExtensions 6 | { 7 | static partial class AssemblyExtension 8 | { 9 | /// 10 | /// Checks for the DebuggableAttribute on the assembly provided to determine 11 | /// whether it has been built in Debug mode. 12 | /// 13 | internal static bool GetIsDebugBuild(this Assembly assembly) 14 | { 15 | return assembly 16 | .GetCustomAttributes(false) 17 | .OfType() 18 | .Select(x => x.IsJITTrackingEnabled) 19 | .FirstOrDefault(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Quarks.Tests/UncapitalizeTests.cs: -------------------------------------------------------------------------------- 1 | using Machine.Specifications; 2 | 3 | namespace Quarks.Tests 4 | { 5 | [Subject(typeof(Inflector))] 6 | class When_using_uncapitalize 7 | { 8 | It should_handle_these_cases = () => 9 | { 10 | // Just lowers the first char and leaves the rest alone 11 | "some title".Uncapitalize().ShouldEqual("some title"); 12 | "some Title".Uncapitalize().ShouldEqual("some Title"); 13 | "SOMETITLE".Uncapitalize().ShouldEqual("sOMETITLE"); 14 | "someTitle".Uncapitalize().ShouldEqual("someTitle"); 15 | "some title goes here".Uncapitalize().ShouldEqual("some title goes here"); 16 | "some TITLE".Uncapitalize().ShouldEqual("some TITLE"); 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/ConfigForASystemTimeOf.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Machine.Fakes; 3 | 4 | namespace Quarks.Machine.Fakes 5 | { 6 | class ConfigForASystemTimeOf 7 | { 8 | internal ConfigForASystemTimeOf(DateTime fakeTime) 9 | { 10 | _fakeTime = fakeTime; 11 | } 12 | 13 | internal ConfigForASystemTimeOf(int year, int month, int day) 14 | { 15 | _fakeTime = new DateTime(year, month, day); 16 | } 17 | 18 | OnEstablish context = ctx => 19 | { 20 | SystemTime.Now = _fakeTime; 21 | SystemTime.UtcNow = _fakeTime; 22 | SystemTime.Today = _fakeTime.Date; 23 | }; 24 | 25 | OnCleanup after = ctx => SystemTime.Reset(); 26 | 27 | static DateTime _fakeTime; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Quarks/SystemTimeOffset.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Quarks 4 | { 5 | static class SystemTimeOffset 6 | { 7 | static Func _now; 8 | static Func _utcNow; 9 | 10 | static SystemTimeOffset() 11 | { 12 | Reset(); 13 | } 14 | 15 | internal static DateTimeOffset Now 16 | { 17 | get { return _now(); } 18 | set { _now = () => value; } 19 | } 20 | 21 | internal static DateTimeOffset UtcNow 22 | { 23 | get { return _utcNow(); } 24 | set { _utcNow = () => value; } 25 | } 26 | 27 | internal static void Reset() 28 | { 29 | _now = () => DateTimeOffset.Now; 30 | _utcNow = () => DateTimeOffset.UtcNow; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Quarks/NHibernate/ISessionFactoryExtensions/GetCurrentOrNewSession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NHibernate; 3 | using NHibernate.Context; 4 | 5 | namespace Quarks.NHibernate.ISessionFactoryExtensions 6 | { 7 | static partial class SessionFactoryExtension 8 | { 9 | internal static ISession GetCurrentOrNewSession(this ISessionFactory sessionFactory, Action onSessionOpened = null) 10 | { 11 | if (CurrentSessionContext.HasBind(sessionFactory)) 12 | return sessionFactory.GetCurrentSession(); 13 | var session = sessionFactory.OpenSession(); 14 | if (onSessionOpened != null) 15 | onSessionOpened(session); 16 | CurrentSessionContext.Bind(session); 17 | return session; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Quarks/System.Web/FakeHttpResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | using System.Web; 3 | 4 | namespace Quarks.System.Web 5 | { 6 | class FakeHttpResponse : HttpResponseBase 7 | { 8 | private readonly StringBuilder _outputString = new StringBuilder(); 9 | 10 | internal string ResponseOutput 11 | { 12 | get { return (_outputString).ToString(); } 13 | } 14 | 15 | public override int StatusCode { get; set; } 16 | 17 | public override string RedirectLocation { get; set; } 18 | 19 | public override void Write(string s) 20 | { 21 | _outputString.Append(s); 22 | } 23 | 24 | public override string ApplyAppPathModifier(string virtualPath) 25 | { 26 | return virtualPath; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/UserType/CustomTypeByteType.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | using Quarks.NHibernate.UserTypes; 6 | 7 | namespace Quarks.FluentNHibernate.Conventions.UserType 8 | { 9 | class CustomTypeByteType : IUserTypeConvention 10 | { 11 | public void Accept(IAcceptanceCriteria criteria) 12 | { 13 | criteria.Expect(x => x.Property.PropertyType == typeof(byte)); 14 | } 15 | 16 | public void Apply(IPropertyInstance instance) 17 | { 18 | instance.CustomType(typeof(ByteType)); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/UserType/CustomTypeUIntType.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | using Quarks.NHibernate.UserTypes; 6 | 7 | namespace Quarks.FluentNHibernate.Conventions.UserType 8 | { 9 | class CustomTypeUIntType : IUserTypeConvention 10 | { 11 | public void Accept(IAcceptanceCriteria criteria) 12 | { 13 | criteria.Expect(x => x.Property.PropertyType == typeof(uint)); 14 | } 15 | 16 | public void Apply(IPropertyInstance instance) 17 | { 18 | instance.CustomType(typeof(UIntType)); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Quarks.Tests/TitleizeTests.cs: -------------------------------------------------------------------------------- 1 | using Machine.Specifications; 2 | 3 | namespace Quarks.Tests 4 | { 5 | [Subject(typeof(Inflector))] 6 | class When_using_titalize 7 | { 8 | It should_handle_these_cases = () => 9 | { 10 | // Uppercases individual words and removes some characters 11 | "some title".Titleize().ShouldEqual("Some Title"); 12 | "some-title".Titleize().ShouldEqual("Some Title"); 13 | "sometitle".Titleize().ShouldEqual("Sometitle"); 14 | "some-title: The begining".Titleize().ShouldEqual("Some Title: The Begining"); 15 | "some_title:_the_begining".Titleize().ShouldEqual("Some Title: The Begining"); 16 | "some title: The_begining".Titleize().ShouldEqual("Some Title: The Begining"); 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /Quarks.Tests/UnderscoreTests.cs: -------------------------------------------------------------------------------- 1 | using Machine.Specifications; 2 | 3 | namespace Quarks.Tests 4 | { 5 | [Subject(typeof(Inflector))] 6 | class When_using_underscore 7 | { 8 | It should_handle_these_cases = () => 9 | { 10 | // Makes an underscored lowercase string 11 | "SomeTitle".Underscore().ShouldEqual("some_title"); 12 | "SomeTitle".Underscore().ShouldEqual("some_title"); 13 | "someTitle".Underscore().ShouldEqual("some_title"); 14 | "some title".Underscore().ShouldEqual("some_title"); 15 | "some title that will be underscored".Underscore().ShouldEqual("some_title_that_will_be_underscored"); 16 | "SomeTitleThatWillBeUnderscored".Underscore().ShouldEqual("some_title_that_will_be_underscored"); 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/UserType/CustomTypeUShortType.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | using Quarks.NHibernate.UserTypes; 6 | 7 | namespace Quarks.FluentNHibernate.Conventions.UserType 8 | { 9 | class CustomTypeUShortType : IUserTypeConvention 10 | { 11 | public void Accept(IAcceptanceCriteria criteria) 12 | { 13 | criteria.Expect(x => x.Property.PropertyType == typeof(ushort)); 14 | } 15 | 16 | public void Apply(IPropertyInstance instance) 17 | { 18 | instance.CustomType(typeof(UShortType)); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasMany/NotKeyNullable.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | using FluentNHibernate.MappingModel.Collections; 6 | 7 | namespace Quarks.FluentNHibernate.Conventions.HasMany 8 | { 9 | class NotKeyNullable : IHasManyConvention, IHasManyConventionAcceptance 10 | { 11 | public void Apply(IOneToManyCollectionInstance instance) 12 | { 13 | instance.Not.KeyNullable(); 14 | } 15 | 16 | public void Accept(IAcceptanceCriteria criteria) 17 | { 18 | criteria.Expect(x => x.LazyLoad == Lazy.False); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/System.Web.Mvc/ConfigForAFakeUserAgent.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | using System.Web.Mvc; 3 | using Machine.Fakes; 4 | 5 | namespace Quarks.Machine.Fakes.System.Web.Mvc 6 | { 7 | class ConfigForAFakeUserAgent 8 | { 9 | static string _userAgent; 10 | 11 | internal ConfigForAFakeUserAgent(string userAgent) 12 | { 13 | _userAgent = userAgent; 14 | } 15 | 16 | OnEstablish context = ctx => 17 | { 18 | var request = ctx.An(); 19 | request.WhenToldTo(req => req.UserAgent).Return(_userAgent); 20 | var httpContext = ctx.An(); 21 | httpContext.WhenToldTo(x => x.Request).Return(request); 22 | ctx.Configure(new ControllerContext { HttpContext = httpContext }); 23 | }; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/UserType/CustomTypeNullableTimeType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using FluentNHibernate.Conventions; 3 | using FluentNHibernate.Conventions.AcceptanceCriteria; 4 | using FluentNHibernate.Conventions.Inspections; 5 | using FluentNHibernate.Conventions.Instances; 6 | using Quarks.NHibernate.UserTypes; 7 | 8 | namespace Quarks.FluentNHibernate.Conventions.UserType 9 | { 10 | class CustomTypeNullableTimeType : IUserTypeConvention 11 | { 12 | public void Accept(IAcceptanceCriteria criteria) 13 | { 14 | criteria.Expect(x => x.Property.PropertyType == typeof(TimeSpan?)); 15 | } 16 | 17 | public void Apply(IPropertyInstance instance) 18 | { 19 | instance.CustomType(typeof(NullableTimeType)); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Quarks.Tests/DasherizeTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Machine.Specifications; 3 | using Quarks.IEnumerableExtensions; 4 | 5 | namespace Quarks.Tests 6 | { 7 | [Subject(typeof(Inflector))] 8 | class When_using_dasherize 9 | { 10 | It should_handle_these_cases = () => 11 | TestData.Dasherized().ForEach(x => x.Key.Dasherize().ShouldEqual(x.Value)); 12 | } 13 | 14 | partial class TestData 15 | { 16 | public static IDictionary Dasherized() 17 | { 18 | return new Dictionary 19 | { 20 | { "some_title", "some-title" }, 21 | { "some-title", "some-title" }, 22 | { "some_title_goes_here", "some-title-goes-here" }, 23 | { "some_title and_another", "some-title and-another" } 24 | }; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Quarks.Tests/HumanizeTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Machine.Specifications; 3 | using Quarks.IEnumerableExtensions; 4 | 5 | namespace Quarks.Tests 6 | { 7 | [Subject(typeof(Inflector))] 8 | class When_using_humanize 9 | { 10 | It should_handle_these_cases = () => 11 | TestData.Humanized().ForEach(x => x.Key.Humanize().ShouldEqual(x.Value)); 12 | } 13 | 14 | partial class TestData 15 | { 16 | public static IDictionary Humanized() 17 | { 18 | return new Dictionary 19 | { 20 | { "some_title", "Some title" }, 21 | { "some-title", "Some-title" }, 22 | { "Some_title", "Some title" }, 23 | { "someTitle", "Sometitle" }, 24 | { "someTitle_Another", "Sometitle another" } 25 | }; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Id/GeneratedByAssigned.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using FluentNHibernate.Conventions; 3 | using FluentNHibernate.Conventions.AcceptanceCriteria; 4 | using FluentNHibernate.Conventions.Inspections; 5 | using FluentNHibernate.Conventions.Instances; 6 | 7 | namespace Quarks.FluentNHibernate.Conventions.Id 8 | { 9 | class GeneratedByAssigned : IIdConvention, IIdConventionAcceptance 10 | { 11 | public void Apply(IIdentityInstance instance) 12 | { 13 | instance.GeneratedBy.Assigned(); 14 | } 15 | 16 | /// 17 | /// Apply convention only to Guid types. 18 | /// 19 | public void Accept(IAcceptanceCriteria criteria) 20 | { 21 | criteria.Expect(id => id.Type.GetUnderlyingSystemType() == typeof(Guid)); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/UserType/CustomTypeEnumerableOfStringType.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using FluentNHibernate.Conventions; 3 | using FluentNHibernate.Conventions.AcceptanceCriteria; 4 | using FluentNHibernate.Conventions.Inspections; 5 | using FluentNHibernate.Conventions.Instances; 6 | using Quarks.NHibernate.UserTypes; 7 | 8 | namespace Quarks.FluentNHibernate.Conventions.UserType 9 | { 10 | class CustomTypeEnumerableOfStringType : IUserTypeConvention 11 | { 12 | public void Accept(IAcceptanceCriteria criteria) 13 | { 14 | criteria.Expect(x => x.Property.PropertyType == typeof(IEnumerable)); 15 | } 16 | 17 | public void Apply(IPropertyInstance instance) 18 | { 19 | instance.CustomType(typeof(EnumerableOfStringType)); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Quarks/NHibernate/ISessionFactoryExtensions/HasCurrentSessionContext.cs: -------------------------------------------------------------------------------- 1 | using NHibernate; 2 | using NHibernate.Context; 3 | using NHibernate.Engine; 4 | 5 | namespace Quarks.NHibernate.ISessionFactoryExtensions 6 | { 7 | static partial class SessionFactoryExtension 8 | { 9 | internal static bool HasCurrentSessionContext(this ISessionFactory sessionFactory) 10 | { 11 | return HasCurrentSessionContext(sessionFactory); 12 | } 13 | 14 | internal static bool HasCurrentSessionContext(this ISessionFactory sessionFactory) where T : CurrentSessionContext 15 | { 16 | var sessionFactoryImplementor = sessionFactory as ISessionFactoryImplementor; 17 | return sessionFactoryImplementor != null && 18 | sessionFactoryImplementor.CurrentSessionContext as T != null; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Quarks.Tests/CapitalizeTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Machine.Specifications; 3 | using Quarks.IEnumerableExtensions; 4 | 5 | namespace Quarks.Tests 6 | { 7 | [Subject(typeof(Inflector))] 8 | class When_using_capitalize 9 | { 10 | It should_handle_these_cases = () => 11 | TestData.Capitalized().ForEach(x => x.Key.Capitalize().ShouldEqual(x.Value)); 12 | } 13 | 14 | partial class TestData 15 | { 16 | public static IDictionary Capitalized() 17 | { 18 | return new Dictionary 19 | { 20 | { "some title", "Some title" }, 21 | { "some Title", "Some title" }, 22 | { "SOMETITLE", "Sometitle" }, 23 | { "someTitle", "Sometitle" }, 24 | { "some title goes here", "Some title goes here" }, 25 | { "some TITLE", "Some title" } 26 | }; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /Quarks.Tests/EnumExtensions/GetAttributeOfTypeTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Machine.Specifications; 3 | using Quarks.EnumExtensions; 4 | 5 | namespace Quarks.Tests.EnumExtensions 6 | { 7 | [Subject(typeof(EnumExtension))] 8 | class When_getting_an_attribute_from_enum_value_that_has_this_attribute 9 | { 10 | It should_return_this_attribute = () => 11 | TestEnum.Two.GetAttributeOfType().ShouldBeOfExactType(); 12 | } 13 | 14 | [Subject(typeof(EnumExtension))] 15 | class When_getting_an_attribute_from_enum_value_that_does_not_have_this_attribute 16 | { 17 | It should_return_null = () => 18 | TestEnum.One.GetAttributeOfType().ShouldBeNull(); 19 | } 20 | 21 | enum TestEnum 22 | { 23 | One, 24 | [Some] 25 | Two 26 | } 27 | 28 | class SomeAttribute : Attribute { } 29 | } 30 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/UserType/CustomSqlTypeEnum.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | 6 | namespace Quarks.FluentNHibernate.Conventions.UserType 7 | { 8 | /// 9 | /// Map enums to TinyInt sql types. 10 | /// 11 | class CustomSqlTypeEnum : IUserTypeConvention 12 | { 13 | public void Accept(IAcceptanceCriteria criteria) 14 | { 15 | // Apply only to Enum properties 16 | criteria.Expect(x => x.Property.PropertyType.IsEnum); 17 | criteria.Expect(x => string.IsNullOrEmpty(x.SqlType)); 18 | } 19 | 20 | public void Apply(IPropertyInstance instance) 21 | { 22 | instance.CustomSqlType("tinyint"); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Quarks/SystemTime.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Quarks 4 | { 5 | static class SystemTime 6 | { 7 | static Func _now; 8 | static Func _utcNow; 9 | static Func _today; 10 | 11 | static SystemTime() 12 | { 13 | Reset(); 14 | } 15 | 16 | internal static DateTime Now 17 | { 18 | get { return _now(); } 19 | set { _now = () => value; } 20 | } 21 | 22 | internal static DateTime UtcNow 23 | { 24 | get { return _utcNow(); } 25 | set { _utcNow = () => value; } 26 | } 27 | 28 | internal static DateTime Today 29 | { 30 | get { return _today(); } 31 | set { _today = () => value; } 32 | } 33 | 34 | internal static void Reset() 35 | { 36 | _now = () => DateTime.Now; 37 | _utcNow = () => DateTime.UtcNow; 38 | _today = () => DateTime.Today; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Quarks.Tests/FluentNHibernate/FilterableTypeSourceTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using Machine.Specifications; 6 | using Quarks.FluentNHibernate; 7 | 8 | namespace Quarks.Tests.FluentNHibernate 9 | { 10 | [Subject(typeof(FilterableTypeSource))] 11 | class When_creating_a_type_filter_and_then_filtering_further 12 | { 13 | It should_apply_both_predicates = () => 14 | types.Single().ShouldEqual(typeof(Foo)); 15 | 16 | Because of = () => 17 | types = FilterableTypeSource.CreateTypeFilter(x => typeof(Foo).IsAssignableFrom(x)) 18 | .FromAssemblies(Assembly.GetExecutingAssembly()).Where(x => x.BaseType == typeof(object)).GetTypes(); 19 | 20 | static IEnumerable types; 21 | 22 | class Foo { } 23 | class Bar : Foo { } 24 | class Baz : Bar { } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Quarks/EnumExtensions/GetAttributeOfType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Quarks.EnumExtensions 4 | { 5 | static partial class EnumExtension 6 | { 7 | /// 8 | /// Gets an attribute on an enum field value 9 | /// 10 | /// The type of the attribute you want to retrieve 11 | /// The enum value 12 | /// The attribute of type T that exists on the enum value or null if it does not exist 13 | internal static T GetAttributeOfType(this Enum enumVal) where T : Attribute 14 | { 15 | var type = enumVal.GetType(); 16 | var memberInfo = type.GetMember(enumVal.ToString()); 17 | var attributes = memberInfo[0].GetCustomAttributes(typeof(T), false); 18 | if (attributes.Length == 0) 19 | return null; 20 | 21 | return (T)attributes[0]; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Property/NotNullable.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using FluentNHibernate.Conventions; 3 | using FluentNHibernate.Conventions.AcceptanceCriteria; 4 | using FluentNHibernate.Conventions.Inspections; 5 | using FluentNHibernate.Conventions.Instances; 6 | using FluentNHibernate.Utils; 7 | 8 | namespace Quarks.FluentNHibernate.Conventions.Property 9 | { 10 | class NotNullable : IPropertyConvention, IPropertyConventionAcceptance 11 | { 12 | public void Apply(IPropertyInstance instance) 13 | { 14 | instance.Not.Nullable(); 15 | } 16 | 17 | public void Accept(IAcceptanceCriteria criteria) 18 | { 19 | criteria.Expect(x => x.Property.PropertyType.IsValueType && !x.Property.PropertyType.IsNullable() || x.Property.MemberInfo.GetMemberAttribute() != null); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Reference/FetchJoin.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | using FluentNHibernate.Mapping; 6 | 7 | namespace Quarks.FluentNHibernate.Conventions.Reference 8 | { 9 | /// 10 | /// All many-to-one references, unless explicitly specified and not lazy, use Fetch.Join(). 11 | /// 12 | class ReferenceFetchJoinLoadConvention : IReferenceConvention, IReferenceConventionAcceptance 13 | { 14 | public void Apply(IManyToOneInstance instance) 15 | { 16 | instance.Fetch.Join(); 17 | } 18 | 19 | public void Accept(IAcceptanceCriteria criteria) 20 | { 21 | criteria.Expect(x => x.LazyLoad.Equals(Laziness.False)); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Reference/NotNullable.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using FluentNHibernate.Conventions; 3 | using FluentNHibernate.Conventions.AcceptanceCriteria; 4 | using FluentNHibernate.Conventions.Inspections; 5 | using FluentNHibernate.Conventions.Instances; 6 | using FluentNHibernate.Utils; 7 | 8 | namespace Quarks.FluentNHibernate.Conventions.Reference 9 | { 10 | class NotNullable : IReferenceConvention, IReferenceConventionAcceptance 11 | { 12 | public void Apply(IManyToOneInstance instance) 13 | { 14 | instance.Not.Nullable(); 15 | } 16 | 17 | public void Accept(IAcceptanceCriteria criteria) 18 | { 19 | criteria.Expect(x => x.Property.PropertyType.IsValueType && !x.Property.PropertyType.IsNullable() || x.Property.MemberInfo.GetMemberAttribute() != null); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Quarks/NHibernate/UserTypes/UShortType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using NHibernate; 4 | using NHibernate.SqlTypes; 5 | 6 | namespace Quarks.NHibernate.UserTypes 7 | { 8 | /// 9 | /// IUserType implementation for mapping System.UInt16 to a int. 10 | /// 11 | [Serializable] 12 | public class UShortType : ImmutableUserTypeBase 13 | { 14 | public override object NullSafeGet(IDataReader rs, string[] names, object owner) 15 | { 16 | var obj = NHibernateUtil.UInt16.NullSafeGet(rs, names[0]); 17 | 18 | return obj ?? 0; 19 | } 20 | 21 | public override void NullSafeSet(IDbCommand cmd, object value, int index) 22 | { 23 | ((IDataParameter)cmd.Parameters[index]).Value = value; 24 | } 25 | 26 | public override SqlType[] SqlTypes 27 | { 28 | get { return new[] { NHibernateUtil.Int32.SqlType }; } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Class/Table.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | 6 | namespace Quarks.FluentNHibernate.Conventions.Class 7 | { 8 | /// 9 | /// Apply standard table name convention of "dbo.EntityClassName". 10 | /// 11 | class Table : IClassConvention, IClassConventionAcceptance 12 | { 13 | public void Apply(IClassInstance instance) 14 | { 15 | instance.Table(instance.EntityType.GetTableName()); 16 | } 17 | 18 | public void Accept(IAcceptanceCriteria criteria) 19 | { 20 | // Table is empty or the default value. 21 | criteria.Expect(c => string.IsNullOrEmpty(c.TableName) || c.TableName == string.Format("`{0}`", c.EntityType.Name)); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Quarks.Tests/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Quarks/NHibernate/UserTypes/ByteType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using NHibernate; 4 | using NHibernate.SqlTypes; 5 | 6 | namespace Quarks.NHibernate.UserTypes 7 | { 8 | /// 9 | /// IUserType implementation for mapping System.UInt16 to a int. 10 | /// 11 | [Serializable] 12 | public class ByteType : ImmutableUserTypeBase 13 | { 14 | public override object NullSafeGet(IDataReader rs, string[] names, object owner) 15 | { 16 | var obj = NHibernateUtil.Byte.NullSafeGet(rs, names[0]); 17 | 18 | if (obj == null) 19 | return 0; 20 | 21 | return obj; 22 | } 23 | 24 | public override void NullSafeSet(IDbCommand cmd, object value, int index) 25 | { 26 | ((IDataParameter)cmd.Parameters[index]).Value = value; 27 | } 28 | 29 | public override SqlType[] SqlTypes 30 | { 31 | get { return new[] { NHibernateUtil.Byte.SqlType }; } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Quarks/FileStore.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FileStore 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Utility class for persisting objects to file paths 13 | en-US 14 | quarks file store 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/IEntity.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.IEntity 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An interface that defines the property: object Id { get; } 13 | en-US 14 | quarks ientity id 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Property/StringLength.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using FluentNHibernate.Conventions; 3 | using FluentNHibernate.Conventions.AcceptanceCriteria; 4 | using FluentNHibernate.Conventions.Inspections; 5 | using FluentNHibernate.Conventions.Instances; 6 | 7 | namespace Quarks.FluentNHibernate.Conventions.Property 8 | { 9 | class StringLength : IPropertyConvention, IPropertyConventionAcceptance 10 | { 11 | public void Apply(IPropertyInstance instance) 12 | { 13 | var attribute = instance.Property.MemberInfo.GetMemberAttribute(); 14 | var length = attribute != null ? attribute.MaximumLength : 4001; // Anything over 4000 equates to (max) 15 | instance.Length(length); 16 | } 17 | 18 | public void Accept(IAcceptanceCriteria criteria) 19 | { 20 | criteria.Expect(x => x.Property.PropertyType == typeof(string)); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Quarks/Feature.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Feature 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A simple feature-switch class which looks up features in app settings 13 | en-US 14 | quarks feature switch 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/DynamicDictionary.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.DynamicDictionary 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An implmentation of DynamicObject 13 | en-US 14 | quarks dictionary dynamicobject 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/SystemTime.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.SystemTime 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A simple utility class which enables mocking of DateTime 13 | en-US 14 | quarks time date datetime mock 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/Disposable.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Disposable 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A simple utility class which simplifies creating a class that implements IDisposable 13 | en-US 14 | quarks disposable 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Property/Column.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | 6 | namespace Quarks.FluentNHibernate.Conventions.Property 7 | { 8 | class Column : IPropertyConvention, IPropertyConventionAcceptance 9 | { 10 | public void Apply(IPropertyInstance instance) 11 | { 12 | var abbreviation = AttributeHelper.GetTypeAttribute(instance.EntityType); 13 | var columnName = abbreviation == null 14 | ? instance.Name 15 | : abbreviation.Abbreviation + instance.Name; 16 | instance.Column(columnName.EscapeColumnName()); 17 | } 18 | 19 | public void Accept(IAcceptanceCriteria criteria) 20 | { 21 | criteria.Expect(p => p.Columns, Is.Not.Set); 22 | criteria.Expect(p => string.IsNullOrEmpty(p.Formula)); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Quarks/DiagnosticsTextWriter.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.DiagnosticsTextWriter 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A TextWriter that outputs to the debug console 13 | en-US 14 | quarks debug textwriter 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/MemberName.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.MemberName 5 | 2.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A utility class for getting the name of an instance member from a member access lambda 13 | en-US 14 | quarks member name lambda 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/TestRetrier.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.TestRetrier 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A class which is useful for asserting invocations of IRetrier in tests 13 | en-US 14 | quarks retry retrier async interval count 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/System.Web/FakeHttpResponse.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.System.Web.FakeHttpResponse 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A fake implementation of HttpResponseBase 13 | en-US 14 | quarks fake http response 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/AppSettings.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.AppSettings 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Provides a wrapper around ConfigurationManager.AppSettings to allow dependency injections 13 | en-US 14 | quarks configuration appsettings 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/ExpressionVisitors/ParameterRebinderVisitor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq.Expressions; 3 | 4 | namespace Quarks.ExpressionVisitors 5 | { 6 | class ParameterRebinderVisitor : ExpressionVisitor 7 | { 8 | readonly Dictionary _map; 9 | 10 | internal ParameterRebinderVisitor(Dictionary map) 11 | { 12 | _map = map ?? new Dictionary(); 13 | } 14 | 15 | internal static Expression ReplaceParameters(Dictionary map, Expression exp) 16 | { 17 | return new ParameterRebinderVisitor(map).Visit(exp); 18 | } 19 | 20 | protected override Expression VisitParameter(ParameterExpression p) 21 | { 22 | ParameterExpression replacement; 23 | if (_map.TryGetValue(p, out replacement)) 24 | { 25 | p = replacement; 26 | } 27 | return base.VisitParameter(p); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Quarks/SystemTimeOffset.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.SystemTimeOffset 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A simple utility class which enables mocking of DateTimeOffset 13 | en-US 14 | quarks time date datetime datetimeoffset mock 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/NHibernate/ISessionExtensions/Transactionally.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using NHibernate; 3 | 4 | namespace Quarks.NHibernate.ISessionExtensions 5 | { 6 | static partial class SessionExtension 7 | { 8 | internal static void Transactionally(this ISession session, Action action) 9 | { 10 | if (session.Transaction == null || !session.Transaction.IsActive) 11 | using (var transaction = session.BeginTransaction()) 12 | { 13 | action(session); 14 | transaction.Commit(); 15 | } 16 | else 17 | action(session); 18 | } 19 | 20 | internal static T Transactionally(this ISession session, Func func) 21 | { 22 | T result; 23 | if (session.Transaction == null || !session.Transaction.IsActive) 24 | using (var transaction = session.BeginTransaction()) 25 | { 26 | result = func(session); 27 | transaction.Commit(); 28 | } 29 | else 30 | result = func(session); 31 | 32 | return result; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Quarks/Page.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Page 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A simple implementation of generic IReadOnlyList representing a page in a collection 13 | en-US 14 | quarks iqueryable ireadonlycolletion ienumerable ipagination ipage page 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/SentenceSplitAndJoinExtension.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.SentenceSplitAndJoinExtension 5 | 1.0.1 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A utility class for manipulating text in sentences 13 | en-US 14 | quarks sentence manipulate text 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/Retrier.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Retrier 5 | 1.0.1 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A utility class for retrying an invocation a specified number of times, with a specified interval between retries 13 | en-US 14 | quarks retry retrier async interval count 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/TypeExtensions/IsNullable.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.TypeExtensions.IsNullable 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An extension for determining whether or not an object is nullable 13 | en-US 14 | quarks object extension nullable 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/ApplicationAssembly.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Threading; 4 | using System.Web; 5 | using System.Web.Compilation; 6 | 7 | namespace Quarks 8 | { 9 | static class ApplicationAssembly 10 | { 11 | static readonly Lazy _instance = new Lazy(getApplicationAssembly, LazyThreadSafetyMode.ExecutionAndPublication); 12 | 13 | internal static Assembly Instance 14 | { 15 | get { return _instance.Value; } 16 | } 17 | 18 | static Assembly getApplicationAssembly() 19 | { 20 | // Are we in a web application? 21 | if (HttpContext.Current != null) 22 | { 23 | // Get the global application type 24 | var globalAsax = BuildManager.GetGlobalAsaxType(); 25 | if (globalAsax != null && globalAsax.BaseType != null) 26 | return globalAsax.BaseType.Assembly; 27 | } 28 | // Provide entry assembly and fallback to executing assembly 29 | return Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Quarks/AssemblyExtensions/GetVersion.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.AssemblyExtensions.GetVersion 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Gets the version of the assembly containing the given type 13 | en-US 14 | quarks extension assembly version 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/UserType/CustomTypeEnum.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | 6 | namespace Quarks.FluentNHibernate.Conventions.UserType 7 | { 8 | /// 9 | /// Apply convention to map enumerations without a wrapper class. 10 | /// See http://stackoverflow.com/questions/439003/how-do-you-map-an-enum-as-an-int-value-with-fluent-nhibernate 11 | /// 12 | class CustomTypeEnum : IUserTypeConvention 13 | { 14 | public void Accept(IAcceptanceCriteria criteria) 15 | { 16 | // Apply only to Enum properties 17 | criteria.Expect(x => x.Property.PropertyType.IsEnum); 18 | } 19 | 20 | public void Apply(IPropertyInstance instance) 21 | { 22 | instance.CustomType(instance.Property.PropertyType); 23 | // Enumerations can't be null 24 | instance.Not.Nullable(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Quarks/IEnumerableExtensions/Contains.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.IEnumerableExtensions.Contains 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Extends the IEnumerable interface to include a Contains method 13 | en-US 14 | quarks ienumerable contains 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/IEnumerableExtensions/ForEach.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.IEnumerableExtensions.ForEach 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Extends the generic IEnumerable interface to include a ForEach method 13 | en-US 14 | quarks ienumerable foreach 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/AssemblyExtensions/GetIsDebugBuild.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.AssemblyExtensions.GetIsDebugBuild 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Reveals whether or not the given assembly is a debug build 13 | en-US 14 | quarks extension assembly debug 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks.Tests/FluentNHibernate/Conventions/Hibernate/NotAutoImportTests.cs: -------------------------------------------------------------------------------- 1 | using Machine.Specifications; 2 | using Quarks.FluentNHibernate.Conventions.Hibernate; 3 | 4 | namespace Quarks.Tests.FluentNHibernate.Conventions.Hibernate 5 | { 6 | namespace EntityNamespace1 7 | { 8 | [Subject(typeof(NotAutoImport), "This is to prove that we can have multiple classes with the same name but different namespaces, mapped to the same table.")] 9 | class MultiEntity : IdentityFieldProvider 10 | { 11 | public virtual string Name { get; set; } 12 | public virtual string Property1 { get; set; } 13 | } 14 | } 15 | 16 | namespace EntityNamespace2 17 | { 18 | [Subject(typeof(NotAutoImport), "This is to prove that we can have multiple classes with the same name but different namespaces, mapped to the same table.")] 19 | class MultiEntity : IdentityFieldProvider 20 | { 21 | public virtual string Name { get; set; } 22 | public virtual string Property2 { get; set; } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Quarks/AttributeHelper.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.AttributeHelper 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Provides easy methods for obtaining attributes, and improves performance by keeping retrieved attributes in a dictionary cache 13 | en-US 14 | quarks attribute cache 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/EnumExtensions/GetAttributeOfType.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.EnumExtensions.GetAttributeOfType 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Gets the member attribute associated with the given enum value 13 | en-US 14 | quarks extension enum attribute 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/IEnumerableExtensions/Partition.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.IEnumerableExtensions.Partition 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Extends the generic IEnumerable interface to include a Partition method 13 | en-US 14 | quarks ienumerable partition 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/StringExtensions/Contains.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.StringExtensions.Contains 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Adds an extension to String for Contains, with a case-insensitive option 13 | en-US 14 | quarks string extension contains case-insensitive 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/ApplicationAssembly.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.ApplicationAssembly 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Reveals the running application's main or entry assembly. Works for Web applications (where GetEntryAssembly won't) 13 | en-US 14 | quarks application assembly 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/AssemblyExtensions/GetExecutionFolder.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.AssemblyExtensions.GetExecutionFolder 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Gets the execution folder of the given assembly 13 | en-US 14 | quarks extension assembly execution folder 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/FilterableTypeSource.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.FilterableTypeSource 5 | 2.1.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A useful set of classes for building an ITypeSource 13 | en-US 14 | quarks object extension change convert type 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/GenericExtensions/IsEqualToDefault.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.GenericExtensions.IsEqualToDefault 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An extension for asserting whether or not an object is equal to its default value 13 | en-US 14 | quarks equal default 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/Switch.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Switch 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | 13 | A functional switch statement based on code by Bart De Smet: http://bartdesmet.net/blogs/bart/archive/2008/03/30/a-functional-c-type-switch.aspx 14 | 15 | en-US 16 | quarks functional switch 17 | true 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Quarks/IDictionaryExtensions/AddOrUpdate.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.IDictionaryExtensions.AddOrUpdate 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Extends the generic IDictionary interface to include an AddOrUpdate method 13 | en-US 14 | quarks idictionary add update addorupdate 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/IEnumerableExtensions/OrderBy.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.IEnumerableExtensions.OrderBy 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Extends the generic IEnumerable interface to enable ordering by a dynamic property 13 | en-US 14 | quarks ienumerable orderby dynamic property 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/NHibernate/UserTypes/ImmutableUserTypeBase.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.NHibernate.UserTypes.ImmutableUserTypeBase 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A base class for creating immutable user types 13 | en-US 14 | quarks nhibernate user type immutable base 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/NameValueCollectionExtensions/ToDictionary.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.NameValueCollectionExtensions.ToDictionary 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Extends NameValueCollection to include a ToDictionary method 13 | en-US 14 | quarks namevaluecollection todictionary 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/ExpressionVisitors/ParameterRebinderVisitor.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.ExpressionVisitors.ParameterRebinderVisitor 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Rebinds parameters in an expression using a given map 13 | en-US 14 | quarks expression visitor parameter rebind map 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/GetTableName.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.GetTableName 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A type extension for creating a table name 13 | en-US 14 | quarks nhibernate fluentnhibernate convention type extension table name 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/NHibernate/UserTypes/UIntType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using NHibernate; 4 | using NHibernate.SqlTypes; 5 | 6 | namespace Quarks.NHibernate.UserTypes 7 | { 8 | /// 9 | /// IUserType implementation for mapping System.UInt32 to a bigint. 10 | /// 11 | [Serializable] 12 | public class UIntType : ImmutableUserTypeBase 13 | { 14 | public override object NullSafeGet(IDataReader rs, string[] names, object owner) 15 | { 16 | var obj = NHibernateUtil.UInt32.NullSafeGet(rs, names[0]); 17 | 18 | return obj ?? 0; 19 | } 20 | 21 | public override void NullSafeSet(IDbCommand cmd, object value, int index) 22 | { 23 | ((IDataParameter)cmd.Parameters[index]).Value = value; 24 | } 25 | 26 | /// 27 | /// MSSQL doesn't support UInt types, and Sqlite maps it to a 32-bit signed integer, so we need to map it as a 64-bit signed integer. 28 | /// 29 | public override SqlType[] SqlTypes 30 | { 31 | get { return new[] { NHibernateUtil.Int64.SqlType }; } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /pt.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | powershell -NoProfile -ExecutionPolicy Unrestricted -Command ^ 3 | $ErrorActionPreference = 'Stop'; ^ 4 | if (!(Get-Command NuGet -ErrorAction SilentlyContinue) -and !(Test-Path '%LocalAppData%\NuGet\NuGet.exe')) { ^ 5 | Write-Host 'Downloading NuGet.exe'; ^ 6 | (New-Object system.net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '%LocalAppData%\NuGet\NuGet.exe'); ^ 7 | } ^ 8 | if (Test-Path '%LocalAppData%\NuGet\NuGet.exe') { ^ 9 | Set-Alias NuGet (Resolve-Path %LocalAppData%\NuGet\NuGet.exe); ^ 10 | } ^ 11 | Write-Host 'Restoring NuGet packages'; ^ 12 | NuGet restore; ^ 13 | . '.\packages\PowerTasks.3.1.0\Functions.ps1'; ^ 14 | $basePath = Resolve-Path .; ^ 15 | Set-Location '.\Quarks'; ^ 16 | $basePath = Split-Path (Split-Path (Resolve-Path $basePath -Relative)); ^ 17 | $projectName = 'Quarks'; ^ 18 | $packagesPath = '..\packages'; ^ 19 | $invokeBuildPath = Get-RequiredPackagePath Invoke-Build $basePath\$projectName; ^ 20 | & $invokeBuildPath\tools\Invoke-Build.ps1 %* -File .Tasks.ps1; 21 | exit /b %ERRORLEVEL% 22 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Class/SchemaDbo.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Class.SchemaDbo 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A class convention which sets schema to dbo 13 | en-US 14 | quarks nhibernate fluentnhibernate convention class schema dbo 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasOne/FetchJoin.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.HasOne.FetchJoin 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A has one convention which sets fetch join 13 | en-US 14 | quarks nhibernate fluentnhibernate convention has one fetch join 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/IDictionaryExtensions/GetValueOrDefault.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.IDictionaryExtensions.GetValueOrDefault 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Extends the generic IDictionary interface to include a GetValueOrDefault method 13 | en-US 14 | quarks idictionary default getvalueordefault 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Class/NotLazyLoad.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Class.NotLazyLoad 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A class convention which sets not lazyload 13 | en-US 14 | quarks nhibernate fluentnhibernate convention class not lazyload 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasOne/CascadeAll.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | 6 | namespace Quarks.FluentNHibernate.Conventions.HasOne 7 | { 8 | /// 9 | /// For info on Cascade see http://ayende.com/Blog/archive/2006/12/02/nhibernatecascadesthedifferentbetweenallalldeleteorphansandsaveupdate.aspx 10 | /// 11 | class CascadeAll : IHasOneConvention, IHasOneConventionAcceptance 12 | { 13 | public void Apply(IOneToOneInstance instance) 14 | { 15 | // Cascade All from Parent to child 16 | instance.Cascade.All(); 17 | } 18 | 19 | public void Accept(IAcceptanceCriteria criteria) 20 | { 21 | // Apply to ParentEntity entities 22 | criteria.Expect(c => c.EntityType == typeof(TParentEntity)); 23 | // Ignore properties that have already been set 24 | criteria.Expect(c => string.IsNullOrEmpty(c.PropertyRef)); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasOne/CascadeAll.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.HasOne.CascadeAll 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A has one convention which sets cascade all 13 | en-US 14 | quarks nhibernate fluentnhibernate convention has one cascade all 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/ConfigForASystemTimeOf.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Machine.Fakes.ConfigForASystemTimeOf 5 | 1.0.1 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A Machine.Fakes context configuration which mocks the Quarks.SystemTime class 13 | en-US 14 | quarks time date datetime mock machine specifications fakes 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasOne/Constrained.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.HasOne.Constrained 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A has one convention which sets constrained 13 | en-US 14 | quarks nhibernate fluentnhibernate convention has one constrained 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/ObjectExtensions/CanBeRepresentedAsString.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.ObjectExtensions.CanBeRepresentedAsString 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An extension for determining whether or not an object can be repsresented as a string 13 | en-US 14 | quarks object extension represent string 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/TypeExtensions/InvokeGenericMethod.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.TypeExtensions.InvokeGenericMethod 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A Type extension which allows the invocation of a generic method specifying the generic type at runtime 13 | en-US 14 | quarks extension type invoke generic method 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Class/DynamicInsert.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Class.DynamicInsert 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A class convention which sets dynamic insert 13 | en-US 14 | quarks nhibernate fluentnhibernate convention class dynamic insert 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Class/DynamicUpdate.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Class.DynamicUpdate 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A class convention which sets dynamic update 13 | en-US 14 | quarks nhibernate fluentnhibernate convention class dynamic update 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasOne/NotLazyLoad.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.HasOne.NotLazyLoad 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A has one convention which sets not lazy load 13 | en-US 14 | quarks nhibernate fluentnhibernate convention has one not lazy load 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Reference/FetchJoin.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Reference.FetchJoin 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A reference convention which sets fetch join 13 | en-US 14 | quarks nhibernate fluentnhibernate convention reference fetch join 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Reference/ForeignKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using FluentNHibernate.Conventions; 3 | using FluentNHibernate.Conventions.AcceptanceCriteria; 4 | using FluentNHibernate.Conventions.Inspections; 5 | using FluentNHibernate.Conventions.Instances; 6 | 7 | namespace Quarks.FluentNHibernate.Conventions.Reference 8 | { 9 | class ForeignKey : IReferenceConvention, IReferenceConventionAcceptance 10 | { 11 | public void Apply(IManyToOneInstance instance) 12 | { 13 | instance.ForeignKey(getForeignKeyName(instance.Property.DeclaringType, instance.Property.PropertyType)); 14 | } 15 | 16 | /// 17 | /// Ignore properties that have already been set. 18 | /// 19 | public void Accept(IAcceptanceCriteria criteria) 20 | { 21 | criteria.Expect(x => string.IsNullOrEmpty(x.ForeignKey)); 22 | } 23 | 24 | static string getForeignKeyName(Type referencingType, Type referencedType) 25 | { 26 | return string.Format("FK_{0}_{1}", referencingType.GetTableName(), referencedType.GetTableName()); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasMany/NotLazyLoad.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.HasMany.NotLazyLoad 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A has many convention which sets not lazy load 13 | en-US 14 | quarks nhibernate fluentnhibernate convention has many not lazy load 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasOne/Constrained.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | 6 | namespace Quarks.FluentNHibernate.Conventions.HasOne 7 | { 8 | /// 9 | /// For info on Cascade see http://ayende.com/Blog/archive/2006/12/02/nhibernatecascadesthedifferentbetweenallalldeleteorphansandsaveupdate.aspx 10 | /// 11 | class Constrained : IHasOneConvention, IHasOneConventionAcceptance 12 | { 13 | public void Apply(IOneToOneInstance instance) 14 | { 15 | // Child is constrained. Parent record must exist 16 | instance.Constrained(); 17 | } 18 | 19 | public void Accept(IAcceptanceCriteria criteria) 20 | { 21 | // Apply to children of ParentEntity 22 | criteria.Expect(c => c.Class == typeof(TParentEntity)); 23 | // Ignore properties that have already been set 24 | criteria.Expect(c => string.IsNullOrEmpty(c.PropertyRef)); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/AutoMapper/MappingContext.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Machine.Fakes.AutoMapper.MappingContext 5 | 1.0.1 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A Machine.Fakes context configuration which simplifies testing of AutoMapper Profile classes 13 | en-US 14 | quarks automapper mock machine specifications fakes 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/NHibernate/UserTypes/ImmutableCompositeUserTypeBase.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.NHibernate.UserTypes.ImmutableCompositeUserTypeBase 5 | 1.0.1 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A base class for creating immutable composite user types 13 | en-US 14 | quarks nhibernate user type immutable composite base 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Class/CacheReadWrite.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Class.CacheReadWrite 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A class convention which sets cache to read-write 13 | en-US 14 | quarks nhibernate fluentnhibernate convention class cache read write 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasMany/BatchSize100.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.HasMany.BatchSize100 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A has many convention which sets batch size to 100 13 | en-US 14 | quarks nhibernate fluentnhibernate convention has many batch size 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasMany/NotKeyUpdate.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.HasMany.NotKeyUpdate 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A has many convention which sets not key update 13 | en-US 14 | quarks nhibernate fluentnhibernate convention has many not key update 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Id/GeneratedByNative.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Id.GeneratedByNative 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An id convention which sets generated by native 13 | en-US 14 | quarks nhibernate fluentnhibernate convention id generated by native 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Reference/NotLazyLoad.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Reference.NotLazyLoad 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A reference convention which sets not lazy load 13 | en-US 14 | quarks nhibernate fluentnhibernate convention reference not lazy load 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/EscapeColumnName.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.EscapeColumnName 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A string extension for creating an escaped column name 13 | en-US 14 | quarks nhibernate fluentnhibernate convention string extension escape column name 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/IDictionaryExtensions/GetValueOrDefault.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Quarks.IDictionaryExtensions 5 | { 6 | static partial class DictionaryExtension 7 | { 8 | internal static TValue GetValueOrDefault(this IDictionary dictionary, TKey key) 9 | { 10 | TValue value; 11 | dictionary.TryGetValue(key, out value); 12 | return value; 13 | } 14 | 15 | internal static TValue GetValueOrDefault(this IDictionary dictionary, TKey key, TValue defaultValue, bool cacheDefault = false) 16 | { 17 | TValue value; 18 | return !dictionary.TryGetValue(key, out value) 19 | ? defaultValue 20 | : value; 21 | } 22 | 23 | internal static TValue GetValueOrDefault(this IDictionary dictionary, TKey key, Func createDefaultValue) 24 | { 25 | TValue value; 26 | if (dictionary.TryGetValue(key, out value)) 27 | return value; 28 | value = createDefaultValue(); 29 | dictionary.Add(key, value); 30 | return value; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Quarks/NHibernate/ISessionExtensions/Transactionally.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.NHibernate.ISessionExtensions.Transactionally 5 | 2.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Wraps a session action in a transaction if there is no active transaction in progress 13 | en-US 14 | quarks nhibernate isession extension transaction 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/ObjectExtensions/ToEnumerable.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.ObjectExtensions.ToEnumerable 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An extension for representing an object's public instance property values as a series of values in alphabetical order of the property names 13 | en-US 14 | quarks object extension enumerable properties 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasMany/NotKeyNullable.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.HasMany.NotKeyNullable 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A has many convention which sets not key nullable 13 | en-US 14 | quarks nhibernate fluentnhibernate convention has many not key nullable 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/Inflector.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Inflector 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A utility class based on https://github.com/srkirkland/Inflector for manipulating text 13 | en-US 14 | quarks inflector manipulate text 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/UserType/CustomSqlTypeEnum.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.UserType.CustomSqlTypeEnum 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A user type convention which sets sql type for enums 13 | en-US 14 | quarks nhibernate fluentnhibernate convention user type sql enum 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/UserType/CustomTypeEnum.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.UserType.CustomTypeEnum 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A user type convention which sets custom type for enums 13 | en-US 14 | quarks nhibernate fluentnhibernate convention user type custom enum 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/NHibernate/ISessionExtensions/ConfigureAsReadOnly.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.NHibernate.ISessionExtensions.ConfigureAsReadOnly 5 | 1.0.1 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An extension method which sets DefaultReadOnly to true and FlushMode to Never 13 | en-US 14 | quarks nhibernate isession extension readonly flushmode 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/ExpressionVisitors/MemberAccessPathVisitor.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.ExpressionVisitors.MemberAccessPathVisitor 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An implementation of ExpressionVisitor that builds up a path string that represents member access in an Expression 13 | en-US 14 | quarks expression visitor member access path 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/System.Web.Mvc/ConfigForAnAjaxRequest.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Machine.Fakes.System.Web.Mvc.ConfigForAnAjaxRequest 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A Machine.Fakes context configuration which fakes an ajax http request 13 | en-US 14 | quarks web mvc ajax request mock machine specifications fakes 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/NHibernate/UserTypes/ByteType.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.NHibernate.UserTypes.ByteType 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An IUserType for byte 13 | en-US 14 | quarks nhibernate user type byte 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/NHibernate/UserTypes/UIntType.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.NHibernate.UserTypes.UIntType 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An IUserType for uint 13 | en-US 14 | quarks nhibernate user type uint 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Hibernate/NotAutoImport.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Hibernate.NotAutoImport 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A hibernate mapping convention which sets not auto import 13 | en-US 14 | quarks nhibernate fluentnhibernate convention hibernatemapping not autoimport 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/System.Web.Mvc/ConfigForAnHttpRequest.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Machine.Fakes.System.Web.Mvc.ConfigForAnHttpRequest 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A Machine.Fakes context configuration which fakes a standard http request 13 | en-US 14 | quarks web mvc http request mock machine specifications fakes 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/NHibernate/SqliteInMemoryDriverConnectionProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using NHibernate.Connection; 4 | 5 | namespace Quarks.NHibernate 6 | { 7 | /// 8 | /// This DriverConnectionProvider can be used with Sqlite In Memory databases to ensure that 9 | /// a single connection is kept and never closed (so the schema is not lost). 10 | /// 11 | [Serializable] 12 | public class SqliteInMemoryDriverConnectionProvider : DriverConnectionProvider 13 | { 14 | IDbConnection _connection; 15 | 16 | public override IDbConnection GetConnection() 17 | { 18 | return _connection ?? (_connection = base.GetConnection()); 19 | } 20 | 21 | public override void CloseConnection(IDbConnection conn) 22 | { 23 | // Never close the connection 24 | } 25 | 26 | protected override void Dispose(bool isDisposing) 27 | { 28 | if (isDisposing && _connection != null) 29 | { 30 | if (_connection.State == ConnectionState.Open) 31 | _connection.Close(); 32 | _connection = null; 33 | } 34 | base.Dispose(isDisposing); 35 | } 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Version/NhVersioned.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Version.NhVersioned 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A version convention which sets nhibernate versioning for long/ulong properties named "Version" 13 | en-US 14 | quarks nhibernate fluentnhibernate convention version 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/System.Web.Mvc/ConfigForAFakeUserAgent.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Machine.Fakes.System.Web.Mvc.ConfigForAFakeUserAgent 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A Machine.Fakes context configuration which provides a specified user agent string 13 | en-US 14 | quarks web mvc useragent mock machine specifications fakes 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/NHibernate/UserTypes/UShortType.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.NHibernate.UserTypes.UShortType 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An IUserType for ushort 13 | en-US 14 | quarks nhibernate user type ushort 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks.Tests/IEnumerableExtensions/PartitionTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using Machine.Specifications; 4 | using Quarks.IEnumerableExtensions; 5 | 6 | namespace Quarks.Tests.IEnumerableExtensions 7 | { 8 | [Subject(typeof(EnumerableExtension))] 9 | class When_partitioning_large_collection 10 | { 11 | It should_provide_the_correct_number_of_chunks = () => 12 | chunks.Count().ShouldEqual(CollectionSize / ChunkSize); 13 | 14 | It should_partition_chunks_correctly = () => 15 | { 16 | var count = 0; 17 | foreach (var chunk in chunks.Select(x => x.ToArray())) 18 | { 19 | chunk.Count().ShouldEqual(ChunkSize); 20 | foreach (var item in chunk) item.ShouldEqual(count++); 21 | } 22 | }; 23 | 24 | Because of = () => 25 | chunks = largeCollection.Partition(ChunkSize); 26 | 27 | Establish context = () => 28 | largeCollection = Enumerable.Range(0, CollectionSize); 29 | 30 | const int CollectionSize = 100000; 31 | const int ChunkSize = 1000; 32 | 33 | static IEnumerable largeCollection; 34 | static IEnumerable> chunks; 35 | } 36 | } -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/HasMany/KeyColumn.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | 6 | namespace Quarks.FluentNHibernate.Conventions.HasMany 7 | { 8 | /// 9 | /// Applies the key field convention to the Many end of HasMany relationships - "RelatedEntityTypeId" 10 | /// 11 | class KeyColumn : IHasManyConvention, IHasManyConventionAcceptance 12 | { 13 | public void Apply(IOneToManyCollectionInstance instance) 14 | { 15 | var abbreviation = AttributeHelper.GetTypeAttribute(instance.EntityType); 16 | var prefix = abbreviation == null 17 | ? instance.EntityType.Name 18 | : abbreviation.Abbreviation; 19 | instance.Key.Column((prefix + "Id").EscapeColumnName()); 20 | } 21 | 22 | public void Accept(IAcceptanceCriteria criteria) 23 | { 24 | // Only update properties that haven't been set. 25 | criteria.Expect(x => x.Key.Columns, Is.Not.Set); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Id/Column.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | 6 | namespace Quarks.FluentNHibernate.Conventions.Id 7 | { 8 | /// 9 | /// Applies standard column naming convention for Id fields. 10 | /// 11 | class Column : IIdConvention, IIdConventionAcceptance 12 | { 13 | public void Apply(IIdentityInstance instance) 14 | { 15 | // Standard identity column name is "Id" 16 | var abbreviation = AttributeHelper.GetTypeAttribute(instance.EntityType); 17 | var prefix = abbreviation == null 18 | ? "" 19 | : abbreviation.Abbreviation; 20 | instance.Column((prefix + instance.Name).EscapeColumnName()); 21 | } 22 | 23 | public void Accept(IAcceptanceCriteria criteria) 24 | { 25 | // Ignore id properties that already have column name set 26 | criteria.Expect(id => id.Columns, Is.Not.Set); 27 | criteria.Expect(id => id.Name == "Id"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Id/GeneratedByAssigned.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Id.GeneratedByAssigned 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An id convention which sets generated by assigned if the property type is Guid 13 | en-US 14 | quarks nhibernate fluentnhibernate convention id guid generated by assigned 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/AutoMapper/TypeConverterContext.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Machine.Fakes.AutoMapper.TypeConverterContext 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A Machine.Fakes context configuration which simplifies testing of AutoMapper generic TypeConverter classes 13 | en-US 14 | quarks automapper typeconverter mock machine specifications fakes 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/AutoMapper/ValueResolverContext.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Machine.Fakes.AutoMapper.ValueResolverContext 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A Machine.Fakes context configuration which simplifies testing of AutoMapper generic ValueResolver classes 13 | en-US 14 | quarks automapper valueresolver mock machine specifications fakes 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/ObjectExtensions/ChangeTypeTo.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.ObjectExtensions.ChangeTypeTo 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An extension for converting between types 13 | en-US 14 | quarks object extension change convert type 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Shayne van Asperen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Version/MssqlVersioned.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Version.MssqlVersioned 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A version convention which sets sql server versioning for byte array properties named "Version" 13 | en-US 14 | quarks nhibernate fluentnhibernate convention version mssql 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/NHibernate/SqliteRemapper.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.NHibernate.SqliteRemapper 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | 13 | Utility class used for adjusting NHibernate mappings for options not supported by Sqlite. 14 | See http://kozmic.pl/archive/2009/08/17/adjusting-nhibernate-mapping-for-tests.aspx. 15 | 16 | en-US 17 | quarks nhibernate sqlite map remap 18 | true 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/GenericExtensions/QuasiEquals.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.GenericExtensions.QuasiEquals 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An extension for asserting object equality by using the Quarks.AssertComparer 13 | en-US 14 | quarks object extension quasi equals 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/AbbreviationAttribute.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.AbbreviationAttribute 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An attribute used to define an abbreviation for a table name, to be used when deriving column names 13 | en-US 14 | quarks nhibernate fluentnhibernate convention abbreviation attribute 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/System.Web.Mvc/FakeUrlHelper.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Machine.Fakes.System.Web.Mvc.FakeUrlHelper 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A fake implementation of UrlHelper 13 | en-US 14 | quarks fake url helper 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/NHibernate/ISessionFactoryExtensions/GetCurrentOrNewSession.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.NHibernate.ISessionFactoryExtensions.GetCurrentOrNewSession 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An extension method which gets the current session from context, or opens a new session 13 | en-US 14 | quarks nhibernate isessionfactory extension current session context 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/NHibernate/UserTypes/EnumerableOfStringType.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.NHibernate.UserTypes.EnumerableOfStringType 5 | 1.0.1 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An IUserType for generic IEnumerable 13 | en-US 14 | quarks nhibernate user type byte 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/NHibernate/UserTypes/NullableTimeType.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.NHibernate.UserTypes.NullableTimeType 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An IUserType for generic Nullable of TimeSpan 13 | en-US 14 | quarks nhibernate user type nullable timespan 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/NHibernate/ISessionFactoryExtensions/HasCurrentSessionContext.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.NHibernate.ISessionFactoryExtensions.HasCurrentSessionContext 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An extension method which reveals whether or not a current session context class has been configured 13 | en-US 14 | quarks nhibernate isessionfactory extension current session context 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Class/Table.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Class.Table 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A class convention which sets table 13 | en-US 14 | quarks nhibernate fluentnhibernate convention class table 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Id/GeneratedByNative.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using FluentNHibernate.Conventions; 3 | using FluentNHibernate.Conventions.AcceptanceCriteria; 4 | using FluentNHibernate.Conventions.Inspections; 5 | using FluentNHibernate.Conventions.Instances; 6 | 7 | namespace Quarks.FluentNHibernate.Conventions.Id 8 | { 9 | /// 10 | /// Applies server-side autoincrement setting to primary keys 11 | /// 12 | class GeneratedByNative : IIdConvention, IIdConventionAcceptance 13 | { 14 | public void Apply(IIdentityInstance instance) 15 | { 16 | instance.UnsavedValue("0"); 17 | // Use Native instead of Identity for extra compatibility. They are equivalent on SQL Server 18 | instance.GeneratedBy.Native(); 19 | } 20 | 21 | /// 22 | /// Apply convention only to integer types. 23 | /// 24 | public void Accept(IAcceptanceCriteria criteria) 25 | { 26 | criteria.Expect(id => id.Type.GetUnderlyingSystemType().IsAny( 27 | typeof(Int16), 28 | typeof(Int32), 29 | typeof(Int64), 30 | typeof(UInt16), 31 | typeof(UInt32), 32 | typeof(UInt64))); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Quarks/IdentityFieldProvider.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.IdentityFieldProvider 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | 13 | A trivial class that is used to make sure that Equals and GetHashCode are properly overloaded with the correct semantics 14 | 15 | en-US 16 | quarks identity id ientity equals gethashcode 17 | true 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Quarks/ExpressionExtensions/Compose.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.ExpressionExtensions.Compose 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Expression tree extensions that helps to combine together filtering expression trees 13 | en-US 14 | quarks expression compose and or andalso orelse 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/Feature.cs: -------------------------------------------------------------------------------- 1 | using System.Configuration; 2 | 3 | namespace Quarks 4 | { 5 | /// 6 | /// Simple feature-switch class which looks up features in app settings 7 | /// 8 | public static class Feature 9 | { 10 | const string EnabledFormat = "{0}.Enabled"; 11 | 12 | /// 13 | /// Determines whether a feature is specifically enabled by looking for a ".Enabled" app setting for that feature. 14 | /// Use for features that are disabled by default. 15 | /// 16 | public static bool Enabled(string feature) 17 | { 18 | bool enabled; 19 | bool.TryParse(ConfigurationManager.AppSettings[string.Format(EnabledFormat, feature)], out enabled); 20 | return enabled; 21 | } 22 | 23 | /// 24 | /// Determines whether a feature has been specifically disabled by looking for a ".Enabled" app setting for that feature. 25 | /// Use fo features that are enabled by default. 26 | /// 27 | public static bool Disabled(string feature) 28 | { 29 | bool enabled; 30 | return bool.TryParse(ConfigurationManager.AppSettings[string.Format(EnabledFormat, feature)], out enabled) && 31 | !enabled; 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Property/NotNullable.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Property.NotNullable 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A property convention which sets not nullable 13 | en-US 14 | quarks nhibernate fluentnhibernate convention property not nullable 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/NHibernate/SqlTaggingInterceptor.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.NHibernate.SqlTaggingInterceptor 5 | 1.0.1 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | 13 | An NHibernate IInterceptor which adds an SQL comment containing a method name to all generated SQL. 14 | Finds the method name by walking the stack trace selecting the first method matching the supplied predicate. 15 | 16 | en-US 17 | quarks nhibernate interceptor method tag 18 | true 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Reference/NotNullable.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Reference.NotNullable 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A property convention which sets not nullable 13 | en-US 14 | quarks nhibernate fluentnhibernate convention reference not nullable 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Property/StringLength.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Property.StringLength 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A property convention which sets length for strings 13 | en-US 14 | quarks nhibernate fluentnhibernate convention property string length 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Proxy/EntityInterface.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Proxy.EntityInterface 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A proxy convention for interface entities 13 | en-US 14 | quarks nhibernate fluentnhibernate convention reference column 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/NHibernate/SqliteInMemoryDriverConnectionProvider.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.NHibernate.SqliteInMemoryDriverConnectionProvider 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | 13 | This DriverConnectionProvider can be used with Sqlite In Memory databases to ensure that 14 | a single connection is kept and never closed (so the schema is not lost). 15 | 16 | en-US 17 | quarks nhibernate sqlite memory driver connection provider 18 | true 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Reference/ForeignKey.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Reference.ForeignKey 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A reference convention which sets foreign key 13 | en-US 14 | quarks nhibernate fluentnhibernate convention reference foreign key 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/AssertComparer.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.AssertComparer 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A comparer for asserting equality of objects, including generic types, IEnumerable, generic IComparable and generic IEquatable 13 | en-US 14 | quarks assert comparer 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Quarks/TypeExtensions/InheritsOrImplements.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.TypeExtensions.InheritsOrImplements 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | 13 | A Type extension which returns true if the type either derives from the given type (if the given type is a class or struct), 14 | or implements the given interface, whether it be directly or indirectly through its inheritance hierarchy. 15 | 16 | en-US 17 | quarks extension type inherit implement 18 | true 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/EntityFramework/Conventions/StoreModel/RemoveUnderscoreFromDefaultForeignKeyNames.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.EntityFramework.Conventions.StoreModel.RemoveUnderscoreFromDefaultForeignKeyNames 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An IStoreModelConvention which removes the underscore from default foreign key names 13 | en-US 14 | quarks entity framework convention storemodel remove underscore default foreign key name 15 | true 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/UserType/CustomTypeByteType.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.UserType.CustomTypeByteType 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A user type convention which sets custom type to ByteType 13 | en-US 14 | quarks nhibernate fluentnhibernate convention user type byte 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/UserType/CustomTypeUIntType.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.UserType.CustomTypeUIntType 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A user type convention which sets custom type to UIntType 13 | en-US 14 | quarks nhibernate fluentnhibernate convention user type uint 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/System.Web.Mvc/FakeRequestContext.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Machine.Fakes.System.Web.Mvc.FakeRequestContext 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | Machine.Fakes context configurations which provide methods for creating fake request contexts 13 | en-US 14 | quarks web mvc request mock machine specifications fakes 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Property/CustomTypeBinaryBlob.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Property.CustomTypeBinaryBlob 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A property convention which sets custom type binary blob 13 | en-US 14 | quarks nhibernate fluentnhibernate convention property custom type binary blob 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/UserType/CustomTypeUShortType.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.UserType.CustomTypeUShortType 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A user type convention which sets custom type to UShortType 13 | en-US 14 | quarks nhibernate fluentnhibernate convention user type ushort 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/ObjectExtensions/Flatten.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.ObjectExtensions.Flatten 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An extension for representing a deep object graph as a flat series of values 13 | en-US 14 | quarks object extension enumerable properties flatten 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/System.Web.Mvc/FakeUrlHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Web.Mvc; 3 | using System.Web.Routing; 4 | 5 | namespace Quarks.Machine.Fakes.System.Web.Mvc 6 | { 7 | class FakeUrlHelper : UrlHelper 8 | { 9 | internal static Action RouteRegistration { get; set; } 10 | 11 | static readonly Action defaultRouteRegistration = routes => 12 | routes.MapRoute( 13 | "Default", 14 | "{controller}/{action}/{id}", 15 | new { controller = "Home", action = "Index", id = "" }); 16 | 17 | internal FakeUrlHelper() 18 | : this("http://localhost/") { } 19 | 20 | internal FakeUrlHelper(string currentUrl) 21 | : this(currentUrl, ConfigureRouteCollection()) { } 22 | 23 | internal FakeUrlHelper(RequestContext context) 24 | : base(context, ConfigureRouteCollection()) { } 25 | 26 | internal FakeUrlHelper(string currentUrl, RouteCollection routes) 27 | : base(FakeRequestContext.For(currentUrl), routes) { } 28 | 29 | internal static RouteCollection ConfigureRouteCollection() 30 | { 31 | var routes = new RouteCollection(); 32 | var registerRoutes = RouteRegistration ?? defaultRouteRegistration; 33 | registerRoutes(routes); 34 | return routes; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Quarks.Tests/PascalizeAndCamelizeTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Machine.Specifications; 3 | using Quarks.IEnumerableExtensions; 4 | 5 | namespace Quarks.Tests 6 | { 7 | [Subject(typeof(Inflector))] 8 | class When_using_pascalize 9 | { 10 | It should_handle_these_cases = () => 11 | TestData.Pascalized().ForEach(x => x.Key.Pascalize().ShouldEqual(x.Value)); 12 | } 13 | 14 | [Subject(typeof(Inflector))] 15 | class When_using_camalize 16 | { 17 | It should_handle_these_cases = () => 18 | TestData.Pascalized().ForEach(x => 19 | { 20 | var lowercaseFirstChar = x.Value.Substring(0, 1).ToLower() + x.Value.Substring(1); 21 | x.Key.Camelize().ShouldEqual(lowercaseFirstChar); 22 | }); 23 | } 24 | 25 | partial class TestData 26 | { 27 | public static IDictionary Pascalized() 28 | { 29 | return new Dictionary 30 | { 31 | { "customer", "Customer" }, 32 | { "CUSTOMER", "CUSTOMER" }, 33 | { "CUStomer", "CUStomer" }, 34 | { "customer_name", "CustomerName" }, 35 | { "customer_first_name", "CustomerFirstName" }, 36 | { "customer_first_name_goes_here", "CustomerFirstNameGoesHere" }, 37 | { "customer name", "Customer name" } 38 | }; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /Quarks/NHibernate/UserTypes/NullableTimeType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Data; 3 | using NHibernate; 4 | using NHibernate.SqlTypes; 5 | 6 | namespace Quarks.NHibernate.UserTypes 7 | { 8 | /// 9 | /// IUserType implementation for mapping nullable TimeSpan to an SQL2008 Time type. 10 | /// 11 | [Serializable] 12 | public class NullableTimeType : ImmutableUserTypeBase 13 | { 14 | public override SqlType[] SqlTypes 15 | { 16 | get { return new[] { NHibernateUtil.TimeAsTimeSpan.SqlType }; } 17 | } 18 | 19 | public override object NullSafeGet(IDataReader rs, string[] names, object owner) 20 | { 21 | return NHibernateUtil.TimeAsTimeSpan.NullSafeGet(rs, names[0]); 22 | } 23 | 24 | public override void NullSafeSet(IDbCommand cmd, object value, int index) 25 | { 26 | if (value == null) 27 | ((IDataParameter)cmd.Parameters[index]).Value = DBNull.Value; 28 | else 29 | { 30 | // The way we have to convert timespan to datetime that starts at 1753 is complete rubbish. 31 | // It works so it seems that this DateTime is later converted back to db Time type. 32 | ((IDataParameter)cmd.Parameters[index]).Value = new DateTime(1753, 1, 1).Add((TimeSpan)value); 33 | } 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Quarks.Tests/OrdinalizeTests.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Machine.Specifications; 3 | using Quarks.IEnumerableExtensions; 4 | 5 | namespace Quarks.Tests 6 | { 7 | [Subject(typeof(Inflector))] 8 | class When_using_ordinalize 9 | { 10 | It should_handle_these_cases = () => 11 | TestData.Ordinalized().ForEach(x => x.Key.Ordinalize().ShouldEqual(x.Value)); 12 | } 13 | 14 | partial class TestData 15 | { 16 | public static IDictionary Ordinalized() 17 | { 18 | return new Dictionary 19 | { 20 | { 0, "0th" }, 21 | { 1, "1st" }, 22 | { 2, "2nd" }, 23 | { 3, "3rd" }, 24 | { 4, "4th" }, 25 | { 5, "5th" }, 26 | { 6, "6th" }, 27 | { 7, "7th" }, 28 | { 8, "8th" }, 29 | { 9, "9th" }, 30 | { 10, "10th" }, 31 | { 11, "11th" }, 32 | { 12, "12th" }, 33 | { 13, "13th" }, 34 | { 14, "14th" }, 35 | { 20, "20th" }, 36 | { 21, "21st" }, 37 | { 22, "22nd" }, 38 | { 23, "23rd" }, 39 | { 24, "24th" }, 40 | { 100, "100th" }, 41 | { 101, "101st" }, 42 | { 102, "102nd" }, 43 | { 103, "103rd" }, 44 | { 104, "104th" }, 45 | { 110, "110th" }, 46 | { 1000, "1000th" }, 47 | { 1001, "1001st" }, 48 | }; 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Reference/Column.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | 6 | namespace Quarks.FluentNHibernate.Conventions.Reference 7 | { 8 | /// 9 | /// Applies PropertyRef to ManyToOne references to determine the referenced type's Id property 10 | /// using the property name convention of "PropertyEntityTypeId". 11 | /// Override convention by using Column() in your AutoMappingOverride class. 12 | /// 13 | class Column : IReferenceConvention, IReferenceConventionAcceptance 14 | { 15 | public void Apply(IManyToOneInstance instance) 16 | { 17 | var abbreviation = AttributeHelper.GetTypeAttribute(instance.Property.PropertyType); 18 | var prefix = abbreviation == null 19 | ? instance.Property.PropertyType.Name 20 | : abbreviation.Abbreviation; 21 | instance.Column((prefix + "Id").EscapeColumnName()); 22 | } 23 | 24 | public void Accept(IAcceptanceCriteria criteria) 25 | { 26 | // Ignore properties that have already been set 27 | criteria.Expect(c => string.IsNullOrEmpty(c.PropertyRef)); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Quarks.Tests/TypeExtensions/InvokeGenericMethodTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Machine.Specifications; 4 | using Quarks.TypeExtensions; 5 | 6 | namespace Quarks.Tests.TypeExtensions 7 | { 8 | [Subject(typeof(TypeExtension))] 9 | class When_invoking_a_generic_method 10 | { 11 | It should_be_able_to_invoke_a_generic_method = () => 12 | { 13 | var test = new TestInvokeGenericMethodClass(); 14 | typeof(TestInvokeGenericMethodClass).InvokeGenericMethod(test, typeof(int), "ReturnSameType").ShouldEqual(typeof(int)); 15 | }; 16 | 17 | It should_be_able_to_invoke_a_generic_method_with_parameters = () => 18 | { 19 | var test = new TestInvokeGenericMethodClass(); 20 | var result = (KeyValuePair)typeof(TestInvokeGenericMethodClass).InvokeGenericMethod(test, typeof(string), "ReturnSameTypeAndSum", 1, 2); 21 | result.Key.ShouldEqual(typeof(string)); 22 | result.Value.ShouldEqual(3); 23 | }; 24 | 25 | class TestInvokeGenericMethodClass 26 | { 27 | public Type ReturnSameType() 28 | { 29 | return typeof(T); 30 | } 31 | 32 | public KeyValuePair ReturnSameTypeAndSum(int x, int y) 33 | { 34 | return new KeyValuePair(typeof(T), x + y); 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/UserType/CustomTypeNullableTimeType.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.UserType.CustomTypeNullableTimeType 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A user type convention which sets custom type to NullableTimeType 13 | en-US 14 | quarks nhibernate fluentnhibernate convention user type timespan nullable 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Class/NotLazyLoad.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | using FluentNHibernate.Conventions; 3 | using FluentNHibernate.Conventions.AcceptanceCriteria; 4 | using FluentNHibernate.Conventions.Inspections; 5 | using FluentNHibernate.Conventions.Instances; 6 | using FluentNHibernate.Mapping; 7 | using FluentNHibernate.MappingModel.Collections; 8 | 9 | namespace Quarks.FluentNHibernate.Conventions.Class 10 | { 11 | class NotLazyLoad : IClassConvention, IClassConventionAcceptance 12 | { 13 | public void Apply(IClassInstance instance) 14 | { 15 | instance.Not.LazyLoad(); 16 | } 17 | 18 | public void Accept(IAcceptanceCriteria criteria) 19 | { 20 | criteria.Expect(x => !x.LazyLoad && !anyLazyMembers(x)); 21 | } 22 | 23 | static bool anyLazyMembers(IClassInspector inspector) 24 | { 25 | if (inspector.Properties.Any(x => x.LazyLoad)) 26 | return true; 27 | 28 | if (inspector.OneToOnes.Any(x => x.LazyLoad.Equals(Laziness.Proxy) || x.LazyLoad.Equals(Laziness.NoProxy))) 29 | return true; 30 | 31 | if (inspector.References.Any(x => x.LazyLoad.Equals(Laziness.Proxy) || x.LazyLoad.Equals(Laziness.NoProxy))) 32 | return true; 33 | 34 | return inspector.Collections.Any(x => !x.LazyLoad.Equals(Lazy.False)); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/UserType/CustomTypeEnumerableOfStringType.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.UserType.CustomTypeEnumerableOfStringType 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A user type convention which sets custom type to EnumerableOfStringType 13 | en-US 14 | quarks nhibernate fluentnhibernate convention user type ienumerable string 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /Quarks/Machine.Fakes/System.Web.Mvc/ConfigForAFakeUrlHelper.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.Machine.Fakes.System.Web.Mvc.ConfigForAFakeUrlHelper 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A Machine.Fakes context configuration which provides a fake UrlHelper 13 | en-US 14 | quarks web mvc urlhelper mock machine specifications fakes 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Id/Column.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Id.Column 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | An id convention which sets column 13 | en-US 14 | quarks nhibernate fluentnhibernate convention id column 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Quarks/NHibernate/UserTypes/EnumerableOfStringType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using NHibernate; 5 | using NHibernate.SqlTypes; 6 | 7 | namespace Quarks.NHibernate.UserTypes 8 | { 9 | [Serializable] 10 | public class EnumerableOfStringType : ImmutableUserTypeBase> 11 | { 12 | public const string LineSeparator = "\r\n"; 13 | 14 | public override SqlType[] SqlTypes 15 | { 16 | get { return new[] { NHibernateUtil.String.SqlType }; } 17 | } 18 | 19 | public override object NullSafeGet(IDataReader rs, string[] names, object owner) 20 | { 21 | var obj = NHibernateUtil.String.NullSafeGet(rs, names[0]); 22 | return decodeString(obj as string); 23 | } 24 | 25 | static IEnumerable decodeString(string rawData) 26 | { 27 | return string.IsNullOrEmpty(rawData) 28 | ? new string[0] 29 | : rawData.Split(new[] { LineSeparator }, StringSplitOptions.None); 30 | } 31 | 32 | public override void NullSafeSet(IDbCommand cmd, object value, int index) 33 | { 34 | ((IDataParameter)cmd.Parameters[index]).Value = encodeStrings(value as IEnumerable); 35 | } 36 | 37 | static string encodeStrings(IEnumerable strings) 38 | { 39 | return strings == null 40 | ? null 41 | : string.Join(LineSeparator, strings); 42 | } 43 | } 44 | } -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Property/Column.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Quarks.FluentNHibernate.Conventions.Property.Column 5 | 1.0.0 6 | Shayne van Asperen 7 | Shayne van Asperen 8 | https://github.com/shaynevanasperen/Quarks/blob/master/LICENSE 9 | https://github.com/shaynevanasperen/Quarks 10 | https://raw.githubusercontent.com/shaynevanasperen/Quarks/master/Quarks.png 11 | false 12 | A property convention which sets column 13 | en-US 14 | quarks nhibernate fluentnhibernate convention property column 15 | true 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Quarks/FluentNHibernate/Conventions/Version/NhVersioned.cs: -------------------------------------------------------------------------------- 1 | using FluentNHibernate.Conventions; 2 | using FluentNHibernate.Conventions.AcceptanceCriteria; 3 | using FluentNHibernate.Conventions.Inspections; 4 | using FluentNHibernate.Conventions.Instances; 5 | 6 | namespace Quarks.FluentNHibernate.Conventions.Version 7 | { 8 | /// 9 | /// This convention maps a ulong "Version" property using Nhibernate's built-in incremental versioning. 10 | /// This is useful for entity's that won't be updated by other applications that may not include the version property 11 | /// on their POCO. See also . 12 | /// The benefit of this strategy over MssqlVersionedEntityConvention is that there is no need to execute an extra 13 | /// SELECT after each INSERT or UPDATE to retrieve the database generated version. 14 | /// 15 | class NhVersioned : IVersionConvention, IVersionConventionAcceptance 16 | { 17 | public void Apply(IVersionInstance instance) 18 | { 19 | instance.Column("Version"); 20 | instance.UnsavedValue("0"); 21 | } 22 | 23 | public void Accept(IAcceptanceCriteria criteria) 24 | { 25 | criteria.Expect(x => x.Name == "Version" && 26 | (x.Type.GetUnderlyingSystemType() == typeof(long) || 27 | x.Type.GetUnderlyingSystemType() == typeof(ulong))); 28 | } 29 | } 30 | } 31 | --------------------------------------------------------------------------------