├── readme.md ├── Lib ├── Quartz.dll ├── log4net.dll ├── Topshelf.dll ├── NHibernate │ ├── NHibernate.dll │ ├── Iesi.Collections.dll │ ├── NHibernate.ByteCode.Castle.dll │ └── NHibernate.ByteCode.Castle.xml └── Microsoft.AnalysisServices.AdomdClient.dll ├── Etc ├── Patterns.rar ├── enhance-QueuePrototype.rar ├── QueuePrototype │ ├── QueuePrototype │ │ ├── OrderConsumer.cs │ │ ├── Order.cs │ │ ├── OrderProducer.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ ├── SyncEvents.cs │ │ ├── ClassDiagram1.cd │ │ └── QueuePrototype.csproj │ └── QueuePrototype.sln ├── T-SQL │ ├── JoinIdToTable.sql │ └── PagingView.sql └── Javascript │ └── easy.layer.demo.html ├── OrmUtils ├── SQLHelper.cs ├── PrimaryKeyAttribute.cs ├── IQueryTranslator.cs ├── OrmQueryFactory.cs ├── SqlExpressCommandGeneratorFactory.cs ├── DataProviderFactory.cs ├── QueryTranslatorFactory.cs ├── TableAttribute.cs ├── ISqlExpressCommandGenerator.cs ├── SqlServerOrmQuery.cs ├── Properties │ └── AssemblyInfo.cs ├── PrimaryKeyFinder.cs ├── OrmUtils.cs ├── OrmQuery.cs ├── ReflectHelper.cs └── SqlExpressCommand.cs ├── packages ├── NUnit.2.6.2 │ ├── license.txt │ ├── NUnit.2.6.2.nupkg │ └── lib │ │ └── nunit.framework.dll ├── SNAP.1.8.2 │ ├── SNAP.1.8.2.nupkg │ └── lib │ │ ├── net40 │ │ └── Snap.dll │ │ └── net45 │ │ └── Snap.dll ├── Castle.Core.3.1.0 │ ├── Changes.txt │ ├── Committers.txt │ ├── Castle.Core.3.1.0.nupkg │ ├── lib │ │ ├── sl4 │ │ │ └── Castle.Core.dll │ │ ├── net35 │ │ │ └── Castle.Core.dll │ │ └── net40-client │ │ │ └── Castle.Core.dll │ ├── readme.txt │ └── License.txt ├── fasterflect.2.1.3 │ ├── fasterflect.2.1.3.nupkg │ └── lib │ │ ├── net35 │ │ └── Fasterflect.dll │ │ └── net40 │ │ └── Fasterflect.dll ├── EnyimMemcached.2.12 │ ├── EnyimMemcached.2.12.nupkg │ ├── lib │ │ └── net35 │ │ │ └── Enyim.Caching.dll │ └── EnyimMemcached.2.12.nuspec ├── structuremap.2.6.4.1 │ ├── lib │ │ └── net40 │ │ │ └── StructureMap.dll │ └── structuremap.2.6.4.1.nupkg ├── SNAP.StructureMap.1.8 │ ├── SNAP.StructureMap.1.8.nupkg │ ├── lib │ │ ├── net40 │ │ │ └── Snap.StructureMap.dll │ │ └── net45 │ │ │ └── Snap.StructureMap.dll │ └── content │ │ └── StructureMapAopSample.cs.pp ├── ServiceStack.Common.3.9.71 │ ├── lib │ │ ├── sl4 │ │ │ └── README.txt │ │ ├── sl5 │ │ │ ├── README.txt │ │ │ ├── ServiceStack.Common.dll │ │ │ └── ServiceStack.Interfaces.dll │ │ └── net35 │ │ │ ├── ServiceStack.Common.dll │ │ │ └── ServiceStack.Interfaces.dll │ └── ServiceStack.Common.3.9.71.nupkg ├── CommonServiceLocator.1.0 │ ├── CommonServiceLocator.1.0.nupkg │ └── lib │ │ ├── SL30 │ │ └── Microsoft.Practices.ServiceLocation.dll │ │ └── NET35 │ │ └── Microsoft.Practices.ServiceLocation.dll ├── ServiceStack.Text.3.9.11 │ ├── ServiceStack.Text.3.9.11.nupkg │ └── lib │ │ ├── ServiceStack.Text-v3.67.zip │ │ ├── net35 │ │ └── ServiceStack.Text.dll │ │ ├── sl4 │ │ └── ServiceStack.Text.dll │ │ ├── sl5 │ │ └── ServiceStack.Text.dll │ │ └── sl4-windowsphone71 │ │ └── ServiceStack.Text.WP.dll ├── ServiceStack.Text.3.9.71 │ ├── ServiceStack.Text.3.9.71.nupkg │ └── lib │ │ ├── net35 │ │ └── ServiceStack.Text.dll │ │ ├── sl4 │ │ └── ServiceStack.Text.dll │ │ ├── sl5 │ │ └── ServiceStack.Text.dll │ │ └── sl4-windowsphone71 │ │ └── ServiceStack.Text.WP.dll ├── ServiceStack.Redis.3.9.71 │ ├── ServiceStack.Redis.3.9.71.nupkg │ └── lib │ │ └── net35 │ │ └── ServiceStack.Redis.dll ├── CommonServiceLocator.StructureMapAdapter.1.1.0.3 │ ├── lib │ │ └── StructureMapAdapter.dll │ └── CommonServiceLocator.StructureMapAdapter.1.1.0.3.nupkg └── repositories.config ├── Utils ├── Setting │ ├── ISetting.cs │ ├── AppSetting.cs │ └── ClassifySetting.cs ├── Http │ ├── RequestMethod.cs │ ├── RequestParameterComparer.cs │ ├── UrlUtils.cs │ └── BadRequestException.cs ├── FluentEmail │ ├── ITemplateRenderer.cs │ ├── DefaultTemplateRender.cs │ └── IHideObjectMembers.cs ├── Misc │ └── CellMemberAttribute.cs ├── Common │ ├── UrlUtils.cs │ ├── ValueConverter.cs │ ├── XmlSerializerUtils.cs │ ├── DateTimeUtils.cs │ ├── OrmUtils.cs │ ├── StringParseUtils.cs │ ├── StreamUtils.cs │ ├── ReflectHelper.cs │ └── EncryptUtils.cs ├── Properties │ └── AssemblyInfo.cs ├── DataAccess │ └── DapperUtils.cs └── Verify │ └── IDCardVerify.cs ├── Examples ├── RequestTest.aspx ├── Ajax.cs ├── AOP │ ├── Test.aspx.cs │ ├── Test.aspx │ └── Test.aspx.designer.cs ├── RequestTest.aspx.designer.cs ├── Cache │ ├── Test.aspx │ ├── Test.aspx.designer.cs │ └── Test.aspx.cs ├── NHibernate │ ├── Test.aspx │ ├── Test.aspx.cs │ └── Test.aspx.designer.cs ├── RequestTest.aspx.cs ├── Default.aspx.designer.cs ├── Default.aspx.cs ├── Properties │ └── AssemblyInfo.cs ├── Web.Debug.config ├── Web.Release.config └── Default.aspx ├── Data ├── QueryModel │ ├── QueryOperator.cs │ ├── CriteriaOperator.cs │ ├── Query Model.cd │ ├── OrderClause.cs │ ├── Query.cs │ └── Criterion.cs ├── IDataProviderFactory.cs ├── TransactionException.cs ├── Properties │ └── AssemblyInfo.cs ├── DataAccessProviderFactory.cs └── Data.csproj ├── Ajax ├── HttpSessionState.cs ├── AjaxProcessorHttpHandlerSession.cs ├── AjaxProcessorHttpHandlerSessionReadOnly.cs ├── AjaxMethodAttribute.cs ├── Properties │ └── AssemblyInfo.cs ├── ReflectionHelper.cs ├── EmbeddedJavascriptHandler.cs ├── Utility.cs ├── AjaxHandlerFactory.cs ├── AjaxProcessorHttpHandler.cs └── Ajax.csproj ├── Iridescent.Memcached ├── packages.config ├── Properties │ └── AssemblyInfo.cs ├── MemcachedClientFactory.cs ├── MemCache.cs └── Iridescent.Memcached.csproj ├── Iridescent.DependencyResolution ├── packages.config ├── ContainerFactory.cs ├── IObjectContainer.cs ├── Properties │ └── AssemblyInfo.cs └── Iridescent.DependencyResolution.csproj ├── Data.Hibernate ├── DataProviderFactory.cs ├── SessionHelper.cs ├── MappingFiles │ ├── Category.hbm.xml │ ├── Brand.hbm.xml │ └── Diary.hbm.xml └── Properties │ └── AssemblyInfo.cs ├── Examples.IService ├── ITestService.cs ├── Properties │ └── AssemblyInfo.cs └── Examples.IService.csproj ├── Entities ├── Temp.cs ├── DomainObject.cs ├── Properties │ └── AssemblyInfo.cs └── Entities.csproj ├── UnitTest ├── packages.config ├── Utils │ ├── IDCardVerifyTest.cs │ └── DateTimeUtilsTest.cs ├── Redis │ ├── RedisTest.cs │ ├── BinaryRedisCacheTest.cs │ └── HybridRedisCacheTest.cs ├── Properties │ └── AssemblyInfo.cs ├── CacheHandler │ └── CachingHandlerTest.cs ├── OrmExpress │ └── SqlCommandGeneratorTest.cs └── App.config ├── Iridescent.Redis ├── packages.config ├── Config │ ├── RedisConfigurationSection.cs │ ├── Pools.cs │ └── PoolConfig.cs ├── Properties │ └── AssemblyInfo.cs ├── RedisFactory.cs └── RedisCache.cs ├── Iridescent.CacheHandler ├── ICacheKeyGenerator.cs ├── packages.config ├── CacchingAopConfig.cs ├── CachingAttribute.cs ├── Properties │ └── AssemblyInfo.cs ├── CachingInterceptor.cs └── DefaultCacheKeyGenerator.cs ├── Local.testsettings ├── Examples.Service ├── TestService.cs └── Properties │ └── AssemblyInfo.cs ├── Iridescent.vsmdi ├── Iridescent.JobService ├── quartz.config ├── App.config ├── quartz_jobs.config ├── QuartzService.cs ├── Common │ └── EmailUtils.cs ├── Properties │ └── AssemblyInfo.cs └── Program.cs ├── Iridescent.Cache ├── ICache.cs ├── Properties │ └── AssemblyInfo.cs ├── CacheFactory.cs ├── WebCache.cs └── Iridescent.Cache.csproj ├── WebControls ├── Properties │ └── AssemblyInfo.cs └── WebControls.csproj ├── TraceAndTestImpact.testsettings └── .gitignore /readme.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Lib/Quartz.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/Lib/Quartz.dll -------------------------------------------------------------------------------- /Lib/log4net.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/Lib/log4net.dll -------------------------------------------------------------------------------- /Etc/Patterns.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/Etc/Patterns.rar -------------------------------------------------------------------------------- /Lib/Topshelf.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/Lib/Topshelf.dll -------------------------------------------------------------------------------- /OrmUtils/SQLHelper.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/OrmUtils/SQLHelper.cs -------------------------------------------------------------------------------- /Etc/enhance-QueuePrototype.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/Etc/enhance-QueuePrototype.rar -------------------------------------------------------------------------------- /Lib/NHibernate/NHibernate.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/Lib/NHibernate/NHibernate.dll -------------------------------------------------------------------------------- /packages/NUnit.2.6.2/license.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/NUnit.2.6.2/license.txt -------------------------------------------------------------------------------- /Lib/NHibernate/Iesi.Collections.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/Lib/NHibernate/Iesi.Collections.dll -------------------------------------------------------------------------------- /packages/SNAP.1.8.2/SNAP.1.8.2.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/SNAP.1.8.2/SNAP.1.8.2.nupkg -------------------------------------------------------------------------------- /Utils/Setting/ISetting.cs: -------------------------------------------------------------------------------- 1 | namespace Iridescent.Utils.Setting 2 | { 3 | public interface ISetting 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /packages/Castle.Core.3.1.0/Changes.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/Castle.Core.3.1.0/Changes.txt -------------------------------------------------------------------------------- /packages/NUnit.2.6.2/NUnit.2.6.2.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/NUnit.2.6.2/NUnit.2.6.2.nupkg -------------------------------------------------------------------------------- /packages/SNAP.1.8.2/lib/net40/Snap.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/SNAP.1.8.2/lib/net40/Snap.dll -------------------------------------------------------------------------------- /packages/SNAP.1.8.2/lib/net45/Snap.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/SNAP.1.8.2/lib/net45/Snap.dll -------------------------------------------------------------------------------- /Examples/RequestTest.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RequestTest.aspx.cs" Inherits="Examples.RequestTest" %> 2 | -------------------------------------------------------------------------------- /packages/Castle.Core.3.1.0/Committers.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/Castle.Core.3.1.0/Committers.txt -------------------------------------------------------------------------------- /Lib/NHibernate/NHibernate.ByteCode.Castle.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/Lib/NHibernate/NHibernate.ByteCode.Castle.dll -------------------------------------------------------------------------------- /packages/NUnit.2.6.2/lib/nunit.framework.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/NUnit.2.6.2/lib/nunit.framework.dll -------------------------------------------------------------------------------- /Lib/Microsoft.AnalysisServices.AdomdClient.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/Lib/Microsoft.AnalysisServices.AdomdClient.dll -------------------------------------------------------------------------------- /Etc/QueuePrototype/QueuePrototype/OrderConsumer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/Etc/QueuePrototype/QueuePrototype/OrderConsumer.cs -------------------------------------------------------------------------------- /packages/Castle.Core.3.1.0/Castle.Core.3.1.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/Castle.Core.3.1.0/Castle.Core.3.1.0.nupkg -------------------------------------------------------------------------------- /packages/Castle.Core.3.1.0/lib/sl4/Castle.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/Castle.Core.3.1.0/lib/sl4/Castle.Core.dll -------------------------------------------------------------------------------- /packages/fasterflect.2.1.3/fasterflect.2.1.3.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/fasterflect.2.1.3/fasterflect.2.1.3.nupkg -------------------------------------------------------------------------------- /packages/Castle.Core.3.1.0/lib/net35/Castle.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/Castle.Core.3.1.0/lib/net35/Castle.Core.dll -------------------------------------------------------------------------------- /packages/fasterflect.2.1.3/lib/net35/Fasterflect.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/fasterflect.2.1.3/lib/net35/Fasterflect.dll -------------------------------------------------------------------------------- /packages/fasterflect.2.1.3/lib/net40/Fasterflect.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/fasterflect.2.1.3/lib/net40/Fasterflect.dll -------------------------------------------------------------------------------- /OrmUtils/PrimaryKeyAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Iridescent.OrmExpress 4 | { 5 | public class PrimaryKeyAttribute:Attribute 6 | { 7 | } 8 | } -------------------------------------------------------------------------------- /packages/EnyimMemcached.2.12/EnyimMemcached.2.12.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/EnyimMemcached.2.12/EnyimMemcached.2.12.nupkg -------------------------------------------------------------------------------- /Data/QueryModel/QueryOperator.cs: -------------------------------------------------------------------------------- 1 | namespace Iridescent.Data.QueryModel 2 | { 3 | public enum QueryOperator 4 | { 5 | And, 6 | Or 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Utils/Http/RequestMethod.cs: -------------------------------------------------------------------------------- 1 | namespace Iridescent.Utils.Http 2 | { 3 | public enum RequestMethod 4 | { 5 | Get, 6 | Post 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /packages/EnyimMemcached.2.12/lib/net35/Enyim.Caching.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/EnyimMemcached.2.12/lib/net35/Enyim.Caching.dll -------------------------------------------------------------------------------- /packages/structuremap.2.6.4.1/lib/net40/StructureMap.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/structuremap.2.6.4.1/lib/net40/StructureMap.dll -------------------------------------------------------------------------------- /packages/structuremap.2.6.4.1/structuremap.2.6.4.1.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/structuremap.2.6.4.1/structuremap.2.6.4.1.nupkg -------------------------------------------------------------------------------- /packages/Castle.Core.3.1.0/lib/net40-client/Castle.Core.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/Castle.Core.3.1.0/lib/net40-client/Castle.Core.dll -------------------------------------------------------------------------------- /packages/SNAP.StructureMap.1.8/SNAP.StructureMap.1.8.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/SNAP.StructureMap.1.8/SNAP.StructureMap.1.8.nupkg -------------------------------------------------------------------------------- /Ajax/HttpSessionState.cs: -------------------------------------------------------------------------------- 1 | namespace Iridescent.Ajax 2 | { 3 | public enum HttpSessionState 4 | { 5 | ReadOnly, 6 | ReadWrite, 7 | None 8 | } 9 | } -------------------------------------------------------------------------------- /Iridescent.Memcached/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/SNAP.StructureMap.1.8/lib/net40/Snap.StructureMap.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/SNAP.StructureMap.1.8/lib/net40/Snap.StructureMap.dll -------------------------------------------------------------------------------- /packages/SNAP.StructureMap.1.8/lib/net45/Snap.StructureMap.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/SNAP.StructureMap.1.8/lib/net45/Snap.StructureMap.dll -------------------------------------------------------------------------------- /packages/ServiceStack.Common.3.9.71/lib/sl4/README.txt: -------------------------------------------------------------------------------- 1 | ServiceStack Client builds for Silverlight. 2 | 3 | Due to restrictions in Silverlight only the Async operations are supported. -------------------------------------------------------------------------------- /packages/ServiceStack.Common.3.9.71/lib/sl5/README.txt: -------------------------------------------------------------------------------- 1 | ServiceStack Client builds for Silverlight. 2 | 3 | Due to restrictions in Silverlight only the Async operations are supported. -------------------------------------------------------------------------------- /packages/CommonServiceLocator.1.0/CommonServiceLocator.1.0.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/CommonServiceLocator.1.0/CommonServiceLocator.1.0.nupkg -------------------------------------------------------------------------------- /packages/ServiceStack.Text.3.9.11/ServiceStack.Text.3.9.11.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Text.3.9.11/ServiceStack.Text.3.9.11.nupkg -------------------------------------------------------------------------------- /packages/ServiceStack.Text.3.9.11/lib/ServiceStack.Text-v3.67.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Text.3.9.11/lib/ServiceStack.Text-v3.67.zip -------------------------------------------------------------------------------- /packages/ServiceStack.Text.3.9.11/lib/net35/ServiceStack.Text.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Text.3.9.11/lib/net35/ServiceStack.Text.dll -------------------------------------------------------------------------------- /packages/ServiceStack.Text.3.9.11/lib/sl4/ServiceStack.Text.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Text.3.9.11/lib/sl4/ServiceStack.Text.dll -------------------------------------------------------------------------------- /packages/ServiceStack.Text.3.9.11/lib/sl5/ServiceStack.Text.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Text.3.9.11/lib/sl5/ServiceStack.Text.dll -------------------------------------------------------------------------------- /packages/ServiceStack.Text.3.9.71/ServiceStack.Text.3.9.71.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Text.3.9.71/ServiceStack.Text.3.9.71.nupkg -------------------------------------------------------------------------------- /packages/ServiceStack.Text.3.9.71/lib/net35/ServiceStack.Text.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Text.3.9.71/lib/net35/ServiceStack.Text.dll -------------------------------------------------------------------------------- /packages/ServiceStack.Text.3.9.71/lib/sl4/ServiceStack.Text.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Text.3.9.71/lib/sl4/ServiceStack.Text.dll -------------------------------------------------------------------------------- /packages/ServiceStack.Text.3.9.71/lib/sl5/ServiceStack.Text.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Text.3.9.71/lib/sl5/ServiceStack.Text.dll -------------------------------------------------------------------------------- /packages/ServiceStack.Common.3.9.71/lib/sl5/ServiceStack.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Common.3.9.71/lib/sl5/ServiceStack.Common.dll -------------------------------------------------------------------------------- /packages/ServiceStack.Redis.3.9.71/ServiceStack.Redis.3.9.71.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Redis.3.9.71/ServiceStack.Redis.3.9.71.nupkg -------------------------------------------------------------------------------- /packages/ServiceStack.Redis.3.9.71/lib/net35/ServiceStack.Redis.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Redis.3.9.71/lib/net35/ServiceStack.Redis.dll -------------------------------------------------------------------------------- /Iridescent.DependencyResolution/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/ServiceStack.Common.3.9.71/ServiceStack.Common.3.9.71.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Common.3.9.71/ServiceStack.Common.3.9.71.nupkg -------------------------------------------------------------------------------- /packages/ServiceStack.Common.3.9.71/lib/net35/ServiceStack.Common.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Common.3.9.71/lib/net35/ServiceStack.Common.dll -------------------------------------------------------------------------------- /packages/ServiceStack.Common.3.9.71/lib/sl5/ServiceStack.Interfaces.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Common.3.9.71/lib/sl5/ServiceStack.Interfaces.dll -------------------------------------------------------------------------------- /packages/ServiceStack.Common.3.9.71/lib/net35/ServiceStack.Interfaces.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Common.3.9.71/lib/net35/ServiceStack.Interfaces.dll -------------------------------------------------------------------------------- /packages/CommonServiceLocator.1.0/lib/SL30/Microsoft.Practices.ServiceLocation.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/CommonServiceLocator.1.0/lib/SL30/Microsoft.Practices.ServiceLocation.dll -------------------------------------------------------------------------------- /packages/ServiceStack.Text.3.9.11/lib/sl4-windowsphone71/ServiceStack.Text.WP.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Text.3.9.11/lib/sl4-windowsphone71/ServiceStack.Text.WP.dll -------------------------------------------------------------------------------- /packages/ServiceStack.Text.3.9.71/lib/sl4-windowsphone71/ServiceStack.Text.WP.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/ServiceStack.Text.3.9.71/lib/sl4-windowsphone71/ServiceStack.Text.WP.dll -------------------------------------------------------------------------------- /packages/CommonServiceLocator.1.0/lib/NET35/Microsoft.Practices.ServiceLocation.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/CommonServiceLocator.1.0/lib/NET35/Microsoft.Practices.ServiceLocation.dll -------------------------------------------------------------------------------- /packages/CommonServiceLocator.StructureMapAdapter.1.1.0.3/lib/StructureMapAdapter.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/CommonServiceLocator.StructureMapAdapter.1.1.0.3/lib/StructureMapAdapter.dll -------------------------------------------------------------------------------- /Utils/FluentEmail/ITemplateRenderer.cs: -------------------------------------------------------------------------------- 1 | namespace Iridescent.Utils.FluentEmail 2 | { 3 | public interface ITemplateRenderer 4 | { 5 | string Parse(string template, T model, bool isHtml = true); 6 | } 7 | } -------------------------------------------------------------------------------- /OrmUtils/IQueryTranslator.cs: -------------------------------------------------------------------------------- 1 | namespace Iridescent.OrmExpress 2 | { 3 | public interface IQueryTranslator 4 | { 5 | void TranslateCriterias(); 6 | void TranslateOrderClauses(); 7 | void Execute(); 8 | } 9 | } -------------------------------------------------------------------------------- /Data/IDataProviderFactory.cs: -------------------------------------------------------------------------------- 1 | namespace Iridescent.Data 2 | { 3 | /// 4 | /// Summary description for IDataAccessProviderFactory. 5 | /// 6 | public interface IDataProviderFactory 7 | { 8 | IDataContext GetDataContext(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /packages/CommonServiceLocator.StructureMapAdapter.1.1.0.3/CommonServiceLocator.StructureMapAdapter.1.1.0.3.nupkg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lcomplete/Iridescent/master/packages/CommonServiceLocator.StructureMapAdapter.1.1.0.3/CommonServiceLocator.StructureMapAdapter.1.1.0.3.nupkg -------------------------------------------------------------------------------- /OrmUtils/OrmQueryFactory.cs: -------------------------------------------------------------------------------- 1 | namespace Iridescent.OrmExpress 2 | { 3 | public sealed class OrmQueryFactory 4 | { 5 | public static OrmQuery Create(string connectionString) 6 | { 7 | return new SqlServerOrmQuery(connectionString); 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /Data.Hibernate/DataProviderFactory.cs: -------------------------------------------------------------------------------- 1 | namespace Iridescent.Data.Hibernate 2 | { 3 | public class DataProviderFactory : IDataProviderFactory 4 | { 5 | public IDataContext GetDataContext() 6 | { 7 | return new NHibernateDataContext(); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Examples.IService/ITestService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Examples.IService 7 | { 8 | public interface ITestService 9 | { 10 | DateTime GetCurrentDate(int i); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Entities/Temp.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Iridescent.Entities 7 | { 8 | public class Temp 9 | { 10 | public int Id { get; set; } 11 | 12 | public string What { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /OrmUtils/SqlExpressCommandGeneratorFactory.cs: -------------------------------------------------------------------------------- 1 | namespace Iridescent.OrmExpress 2 | { 3 | public class SqlExpressCommandGeneratorFactory 4 | { 5 | public static ISqlExpressCommandGenerator Create() 6 | { 7 | return new SqlExpressCommandGenerator(); 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /OrmUtils/DataProviderFactory.cs: -------------------------------------------------------------------------------- 1 | using Iridescent.Data; 2 | 3 | namespace Iridescent.OrmExpress 4 | { 5 | public class DataProviderFactory : IDataProviderFactory 6 | { 7 | public IDataContext GetDataContext() 8 | { 9 | return new SqlServerDataContext(); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /UnitTest/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Examples/Ajax.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace Examples 7 | { 8 | public class Ajax 9 | { 10 | [Iridescent.Ajax.AjaxMethod] 11 | public int Add(int a,int b) 12 | { 13 | return a + b; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /Iridescent.Redis/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /OrmUtils/QueryTranslatorFactory.cs: -------------------------------------------------------------------------------- 1 | using Iridescent.Data.QueryModel; 2 | 3 | namespace Iridescent.OrmExpress 4 | { 5 | public class QueryTranslatorFactory 6 | { 7 | public static IQueryTranslator Create(SqlExpressCommand command,Query query) 8 | { 9 | return new SqlServerQueryTranslator(command,query); 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /Utils/FluentEmail/DefaultTemplateRender.cs: -------------------------------------------------------------------------------- 1 | namespace Iridescent.Utils.FluentEmail 2 | { 3 | public class DefaultTemplateRender:ITemplateRenderer 4 | { 5 | public string Parse(string template, T model, bool isHtml = true) 6 | { 7 | //TODO enhance this 8 | return template; 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Iridescent.CacheHandler/ICacheKeyGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Text; 6 | 7 | namespace Iridescent.CacheHandler 8 | { 9 | interface ICacheKeyGenerator 10 | { 11 | string CreateCacheKey(MethodBase method, object[] inputs); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Etc/QueuePrototype/QueuePrototype/Order.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace QueuePrototype 4 | { 5 | public class Order 6 | { 7 | public string UserName { get; set; } 8 | 9 | public string ScheduleId { get; set; } 10 | 11 | public DateTime CreateDate { get; set; } 12 | 13 | public DateTime HandleDate { get; set; } 14 | 15 | } 16 | } -------------------------------------------------------------------------------- /OrmUtils/TableAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Iridescent.OrmExpress 4 | { 5 | public class TableAttribute:Attribute 6 | { 7 | public string Name { get; set; } 8 | 9 | public TableAttribute() 10 | { 11 | 12 | } 13 | 14 | public TableAttribute(string name) 15 | { 16 | Name = name; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Examples/AOP/Test.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | 8 | namespace Examples.AOP 9 | { 10 | public partial class Test : System.Web.UI.Page 11 | { 12 | protected void Page_Load(object sender, EventArgs e) 13 | { 14 | 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Local.testsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 这些设置为本地测试运行的默认测试设置。 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Utils/Http/RequestParameterComparer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Iridescent.Utils.Http 5 | { 6 | internal class RequestParameterComparer:IComparer 7 | { 8 | public int Compare(RequestParameter x, RequestParameter y) 9 | { 10 | return StringComparer.CurrentCulture.Compare(x.Name, y.Name); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Examples/RequestTest.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // <自动生成> 3 | // 此代码由工具生成。 4 | // 5 | // 对此文件的更改可能会导致不正确的行为,并且如果 6 | // 重新生成代码,这些更改将会丢失。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Examples { 11 | 12 | 13 | public partial class RequestTest { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/repositories.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Ajax/AjaxProcessorHttpHandlerSession.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web.SessionState; 6 | 7 | namespace Iridescent.Ajax 8 | { 9 | internal class AjaxProcessorHttpHandlerSession:AjaxProcessorHttpHandler,IRequiresSessionState 10 | { 11 | public AjaxProcessorHttpHandlerSession(Type type) : base(type) 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Examples.Service/TestService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Examples.IService; 6 | using Iridescent.CacheHandler; 7 | 8 | namespace Examples.Service 9 | { 10 | public class TestService: ITestService 11 | { 12 | [Caching] 13 | public DateTime GetCurrentDate(int i) 14 | { 15 | return DateTime.Now; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Examples/Cache/Test.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="Examples.Cache.Test" %> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 |
13 | 14 |
15 |
16 | 17 | 18 | -------------------------------------------------------------------------------- /Ajax/AjaxProcessorHttpHandlerSessionReadOnly.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Web.SessionState; 6 | 7 | namespace Iridescent.Ajax 8 | { 9 | internal class AjaxProcessorHttpHandlerSessionReadOnly:AjaxProcessorHttpHandler,IRequiresSessionState,IReadOnlySessionState 10 | { 11 | public AjaxProcessorHttpHandlerSessionReadOnly(Type type) : base(type) 12 | { 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Iridescent.Redis/Config/RedisConfigurationSection.cs: -------------------------------------------------------------------------------- 1 | using System.Configuration; 2 | 3 | namespace Iridescent.Redis.Config 4 | { 5 | /// 6 | /// 功能:Redis配置根节点 7 | /// 作者:娄晨 8 | /// 日期:2014-5-20 9 | /// 10 | public class RedisConfigurationSection:ConfigurationSection 11 | { 12 | [ConfigurationProperty("pools")] 13 | public Pools Pools 14 | { 15 | get { return base["pools"] as Pools; } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /Iridescent.vsmdi: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Data/TransactionException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Iridescent.Data 4 | { 5 | public class TransactionException : ApplicationException 6 | { 7 | public TransactionException() 8 | { 9 | } 10 | 11 | public TransactionException(string message) : base(message) 12 | { 13 | } 14 | 15 | public TransactionException(string message, Exception innerException) 16 | : base(message, innerException) 17 | { 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Iridescent.JobService/quartz.config: -------------------------------------------------------------------------------- 1 | quartz.plugin.xml.type = Quartz.Plugin.Xml.XMLSchedulingDataProcessorPlugin, Quartz 2 | quartz.plugin.xml.fileNames = ~/quartz_jobs.config 3 | 4 | quartz.plugin.xml.scanInterval = 60 5 | 6 | quartz.scheduler.instanceName = MonitorQuartzScheduler 7 | quartz.scheduler.instanceId = AUTO 8 | 9 | quartz.scheduler.exporter.type = Quartz.Simpl.RemotingSchedulerExporter, Quartz 10 | quartz.scheduler.exporter.port = 30555 11 | quartz.scheduler.exporter.bindName = QuartzScheduler 12 | quartz.scheduler.exporter.channelType = tcp -------------------------------------------------------------------------------- /Iridescent.Cache/ICache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Iridescent.Cache 7 | { 8 | public interface ICache 9 | { 10 | bool Set(string key, object value); 11 | bool Set(string key, object value, DateTime expiresAt); 12 | bool Set(string key, object value, TimeSpan expiresIn); 13 | 14 | object Get(string key); 15 | T Get(string key); 16 | 17 | bool Remove(string key); 18 | 19 | void FlushAll(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Examples/NHibernate/Test.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="Examples.NHibernate.Test" %> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 | 13 |
14 |
15 | 16 | 17 | -------------------------------------------------------------------------------- /Examples/RequestTest.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | 8 | namespace Examples 9 | { 10 | public partial class RequestTest : System.Web.UI.Page 11 | { 12 | protected void Page_Load(object sender, EventArgs e) 13 | { 14 | Response.Write(Request.Headers["X-IridescentAjax-Method"]); 15 | Response.Write(Environment.NewLine); 16 | Response.Write(Request.Params["abc"]); 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /Iridescent.JobService/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /packages/Castle.Core.3.1.0/readme.txt: -------------------------------------------------------------------------------- 1 | Thanks for downloading this Castle package. 2 | You can find full list of changes in changes.txt 3 | 4 | Documentation (work in progress, contributions appreciated): 5 | Dictionary Adapter - http://docs.castleproject.org/Tools.Castle-DictionaryAdapter.ashx 6 | DynamicProxy - http://docs.castleproject.org/Tools.DynamicProxy.ashx 7 | Discusssion group: - http://groups.google.com/group/castle-project-users 8 | StackOverflow tags: - castle-dynamicproxy, castle-dictionaryadapter, castle 9 | 10 | Issue tracker: - http://issues.castleproject.org/dashboard -------------------------------------------------------------------------------- /Data.Hibernate/SessionHelper.cs: -------------------------------------------------------------------------------- 1 | using NHibernate; 2 | using NHibernate.Cfg; 3 | 4 | namespace Iridescent.Data.Hibernate 5 | { 6 | public class SessionHelper 7 | { 8 | private static Configuration cfg; 9 | private static ISessionFactory sessionFactory; 10 | 11 | static SessionHelper() 12 | { 13 | cfg = new Configuration(); 14 | cfg.Configure(); 15 | sessionFactory = cfg.BuildSessionFactory(); 16 | } 17 | 18 | public static ISession GetNewSession() 19 | { 20 | return sessionFactory.OpenSession(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Iridescent.DependencyResolution/ContainerFactory.cs: -------------------------------------------------------------------------------- 1 | using Iridescent.DependencyResolution.Impl; 2 | 3 | namespace Iridescent.DependencyResolution 4 | { 5 | public class ContainerFactory 6 | { 7 | private static IObjectContainer _objectContainer; 8 | 9 | public static IObjectContainer Singleton 10 | { 11 | get 12 | { 13 | if(_objectContainer==null) 14 | _objectContainer=new StructureMapContainer(); 15 | 16 | return _objectContainer; 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Iridescent.Redis/Config/Pools.cs: -------------------------------------------------------------------------------- 1 | using System.Configuration; 2 | 3 | namespace Iridescent.Redis.Config 4 | { 5 | /// 6 | /// 功能:Redis配置结点组 7 | /// 作者:娄晨 8 | /// 日期:2014-5-20 9 | /// 10 | public class Pools : ConfigurationElementCollection 11 | { 12 | protected override ConfigurationElement CreateNewElement() 13 | { 14 | return new PoolConfig(); 15 | } 16 | 17 | protected override object GetElementKey(ConfigurationElement element) 18 | { 19 | return (element as PoolConfig).Name; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Examples/AOP/Test.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="Examples.AOP.Test" %> 2 | <%@ Import Namespace="Examples.IService" %> 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 |
14 | <%=Iridescent.DependencyResolution.ContainerFactory.Singleton.Resolve().GetCurrentDate() %> 15 |
16 |
17 | 18 | 19 | -------------------------------------------------------------------------------- /Iridescent.JobService/quartz_jobs.config: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | true 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Utils/FluentEmail/IHideObjectMembers.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | 4 | namespace Iridescent.Utils.FluentEmail 5 | { 6 | [EditorBrowsable(EditorBrowsableState.Never)] 7 | public interface IHideObjectMembers 8 | { 9 | [EditorBrowsable(EditorBrowsableState.Never)] 10 | Type GetType(); 11 | 12 | [EditorBrowsable(EditorBrowsableState.Never)] 13 | int GetHashCode(); 14 | 15 | [EditorBrowsable(EditorBrowsableState.Never)] 16 | string ToString(); 17 | 18 | [EditorBrowsable(EditorBrowsableState.Never)] 19 | bool Equals(object obj); 20 | } 21 | } -------------------------------------------------------------------------------- /Ajax/AjaxMethodAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Iridescent.Ajax 7 | { 8 | [AttributeUsage(AttributeTargets.Method,AllowMultiple = false)] 9 | public class AjaxMethodAttribute:Attribute 10 | { 11 | public HttpSessionState SessionState { get; private set; } 12 | 13 | public AjaxMethodAttribute():this(HttpSessionState.ReadWrite) 14 | { 15 | 16 | } 17 | 18 | public AjaxMethodAttribute(HttpSessionState sessionState) 19 | { 20 | SessionState = sessionState; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Iridescent.CacheHandler/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Iridescent.CacheHandler/CacchingAopConfig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using Castle.DynamicProxy; 4 | using Snap.StructureMap; 5 | using StructureMap; 6 | using Snap; 7 | 8 | namespace Iridescent.CacheHandler 9 | { 10 | 11 | public static class CacchingAopConfig 12 | { 13 | public static void Config(string includeNamespace) 14 | { 15 | SnapConfiguration.For(c => 16 | { 17 | c.IncludeNamespace(includeNamespace); 18 | c.Bind().To(); 19 | }); 20 | } 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Utils/Http/UrlUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Web; 2 | 3 | namespace Iridescent.Utils.Http 4 | { 5 | public static class UrlUtils 6 | { 7 | public static string UpperCaseUrlEncode(string s) 8 | { 9 | char[] temp = HttpUtility.UrlEncode(s).ToCharArray(); 10 | for (int i = 0; i < temp.Length - 2; i++) 11 | { 12 | if (temp[i] == '%') 13 | { 14 | temp[i + 1] = char.ToUpper(temp[i + 1]); 15 | temp[i + 2] = char.ToUpper(temp[i + 2]); 16 | } 17 | } 18 | return new string(temp); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/EnyimMemcached.2.12/EnyimMemcached.2.12.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | EnyimMemcached 5 | 2.12 6 | Attila Kiskó 7 | Attila Kiskó 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | https://github.com/enyim/EnyimMemcached 10 | false 11 | Memcached client library for .NET based languages. 12 | memcached enyim cache caching 13 | 14 | -------------------------------------------------------------------------------- /packages/Castle.Core.3.1.0/License.txt: -------------------------------------------------------------------------------- 1 | Copyright 2004-2012 Castle Project - http://www.castleproject.org/ 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | -------------------------------------------------------------------------------- /Examples/Default.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // <自动生成> 3 | // 此代码由工具生成。 4 | // 5 | // 对此文件的更改可能会导致不正确的行为,并且如果 6 | // 重新生成代码,这些更改将会丢失。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Examples { 11 | 12 | 13 | public partial class _Default { 14 | 15 | /// 16 | /// form1 控件。 17 | /// 18 | /// 19 | /// 自动生成的字段。 20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 21 | /// 22 | protected global::System.Web.UI.HtmlControls.HtmlForm form1; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Examples/Cache/Test.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // <自动生成> 3 | // 此代码由工具生成。 4 | // 5 | // 对此文件的更改可能会导致不正确的行为,并且如果 6 | // 重新生成代码,这些更改将会丢失。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Examples.Cache { 11 | 12 | 13 | public partial class Test { 14 | 15 | /// 16 | /// form1 控件。 17 | /// 18 | /// 19 | /// 自动生成的字段。 20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 21 | /// 22 | protected global::System.Web.UI.HtmlControls.HtmlForm form1; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Examples/NHibernate/Test.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | using Iridescent.Data; 8 | 9 | namespace Examples.NHibernate 10 | { 11 | public partial class Test : System.Web.UI.Page 12 | { 13 | protected void Page_Load(object sender, EventArgs e) 14 | { 15 | IDataProviderFactory dataProviderFactory = new DataAccessProviderFactory(); 16 | IDataContext dataContext = dataProviderFactory.GetDataContext(); 17 | 18 | grdView.DataSource = dataContext.GetAll(); 19 | grdView.DataBind(); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Examples/AOP/Test.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // <自动生成> 3 | // 此代码由工具生成。 4 | // 5 | // 对此文件的更改可能会导致不正确的行为,并且如果 6 | // 重新生成代码,这些更改将会丢失。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Examples.AOP { 11 | 12 | 13 | public partial class Test { 14 | 15 | /// 16 | /// form1 控件。 17 | /// 18 | /// 19 | /// 自动生成的字段。 20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 21 | /// 22 | protected global::System.Web.UI.HtmlControls.HtmlForm form1; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Utils/Misc/CellMemberAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Iridescent.Utils.Misc 4 | { 5 | /// 6 | /// 列成员属性 7 | /// 8 | public class CellMemberAttribute:Attribute 9 | { 10 | /// 11 | /// Row轴索引 12 | /// 13 | public int Index { get; set; } 14 | 15 | /// 16 | /// Column轴标题 17 | /// 18 | public string Caption { get; set; } 19 | 20 | public CellMemberAttribute(int index) 21 | { 22 | Index = index; 23 | } 24 | 25 | public CellMemberAttribute(string caption) 26 | { 27 | Caption = caption; 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /OrmUtils/ISqlExpressCommandGenerator.cs: -------------------------------------------------------------------------------- 1 | using Iridescent.Data.QueryModel; 2 | 3 | namespace Iridescent.OrmExpress 4 | { 5 | public interface ISqlExpressCommandGenerator 6 | { 7 | 8 | SqlExpressCommand GenerateSelectCommand(Query query = null,bool getCount=false); 9 | 10 | SqlExpressCommand GenerateGetPagingListCommand(int pageIndex, int pageSize,Query query=null); 11 | 12 | SqlExpressCommand GenerateDeleteCommand(Query query = null); 13 | 14 | SqlExpressCommand GenerateDeleteCommand(TEntity entity); 15 | 16 | SqlExpressCommand GenerateUpdateCommand(TEntity entity); 17 | 18 | SqlExpressCommand GenerateInsertCommand(TEntity entity); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /UnitTest/Utils/IDCardVerifyTest.cs: -------------------------------------------------------------------------------- 1 | using Iridescent.Utils.Verify; 2 | using NUnit.Framework; 3 | 4 | namespace UnitTest.Utils 5 | { 6 | 7 | 8 | /// 9 | ///这是 IDCardVerifyTest 的测试类,旨在 10 | ///包含所有 IDCardVerifyTest 单元测试 11 | /// 12 | [TestFixture] 13 | public class IDCardVerifyTest 14 | { 15 | 16 | /// 17 | ///CheckIDCard 的测试 18 | /// 19 | [Test] 20 | public void CheckIDCardTest() 21 | { 22 | string Id = "112502190000201234"; 23 | bool expected = false; 24 | bool actual; 25 | actual = IDCardVerify.CheckIDCard(Id); 26 | Assert.AreEqual(expected, actual); 27 | } 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Iridescent.CacheHandler/CachingAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Snap; 6 | 7 | namespace Iridescent.CacheHandler 8 | { 9 | public class CachingAttribute : MethodInterceptAttribute 10 | { 11 | public TimeSpan CacheTimeSpan { get; private set; } 12 | 13 | public string Group { get; private set; } 14 | 15 | public CachingAttribute(int minutes = 30, string group = "") 16 | : this(TimeSpan.FromMinutes(minutes), group) 17 | { 18 | } 19 | 20 | public CachingAttribute(TimeSpan timeSpan, string group = "") 21 | { 22 | CacheTimeSpan = timeSpan; 23 | Group = group; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Iridescent.JobService/QuartzService.cs: -------------------------------------------------------------------------------- 1 | using log4net; 2 | using Quartz; 3 | using Quartz.Impl; 4 | 5 | namespace Iridescent.JobService 6 | { 7 | class QuartzService 8 | { 9 | private readonly ILog _log = LogManager.GetLogger(typeof(QuartzService)); 10 | 11 | private IScheduler scheduler = null; 12 | 13 | public void Start() 14 | { 15 | _log.Info("统计服务正在启动"); 16 | 17 | scheduler = StdSchedulerFactory.GetDefaultScheduler(); 18 | scheduler.Start(); 19 | } 20 | 21 | public void Stop() 22 | { 23 | if (scheduler != null && !scheduler.IsShutdown) 24 | scheduler.Shutdown(); 25 | 26 | _log.Info("统计服务已停止"); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Utils/Http/BadRequestException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Iridescent.Utils.Http 4 | { 5 | /// 6 | /// 请求得到错误结果时引发的异常 7 | /// 8 | public class BadRequestException:ApplicationException 9 | { 10 | public string Response { get; private set; } 11 | 12 | public BadRequestException(string response) 13 | { 14 | Response = response; 15 | } 16 | 17 | public BadRequestException(string message,string response):base(message) 18 | { 19 | Response = response; 20 | } 21 | 22 | public BadRequestException(string message,string response,Exception innerException):base(message,innerException) 23 | { 24 | Response = response; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Entities/DomainObject.cs: -------------------------------------------------------------------------------- 1 | namespace Iridescent.Entities 2 | { 3 | public class DomainObject 4 | { 5 | //public virtual bool IsValid 6 | //{ 7 | // get 8 | // { 9 | // try 10 | // { 11 | // return this.Validate().IsValid; 12 | // } 13 | // catch 14 | // { 15 | // return false; 16 | // } 17 | // } 18 | //} 19 | 20 | //public virtual ValidationResults Validate() 21 | //{ 22 | // Validator validator = ValidationFactory.CreateValidator(this.GetType()); 23 | // ValidationResults results = new ValidationResults(); 24 | // validator.Validate(this, results); 25 | // return results; 26 | //} 27 | } 28 | } -------------------------------------------------------------------------------- /Data.Hibernate/MappingFiles/Category.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /UnitTest/Redis/RedisTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Iridescent.Redis; 6 | using NUnit.Framework; 7 | 8 | namespace UnitTest.Redis 9 | { 10 | [TestFixture] 11 | class RedisTest 12 | { 13 | [Test] 14 | public void EnsureRedisWork() 15 | { 16 | RedisCache cache = new RedisCache(); 17 | string key = "now"; 18 | DateTime dt = cache.Get(key); 19 | if (dt == DateTime.MinValue) 20 | { 21 | dt = DateTime.Now; 22 | cache.Set(key, dt, TimeSpan.FromMinutes(10)); 23 | } 24 | DateTime dt1 = cache.Get(key); 25 | Console.WriteLine(dt); 26 | Console.WriteLine(dt1); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Utils/Setting/AppSetting.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Configuration; 3 | 4 | namespace Iridescent.Utils.Setting 5 | { 6 | /// 7 | /// AppConfig中的AppSettings中的配置 8 | /// 9 | public static class AppSetting 10 | { 11 | 12 | /// 13 | /// 通过setting键名获取配置,未获取到时返回默认值 14 | /// 15 | /// 16 | /// 17 | /// 18 | private static T GetSetting(string settingKey, T defaultValue=default(T)) where T : IConvertible 19 | { 20 | string value = ConfigurationManager.AppSettings[settingKey]; 21 | 22 | return !string.IsNullOrEmpty(value) ? Common.ValueConverter.Parse(value, defaultValue) : defaultValue; 23 | } 24 | 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Utils/Common/UrlUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Net; 3 | 4 | namespace Iridescent.Utils.Common 5 | { 6 | public static class UrlUtils 7 | { 8 | /// 9 | /// 是否是域名 10 | /// 11 | /// 12 | /// 13 | public static bool IsDomain(string siteUrl) 14 | { 15 | try 16 | { 17 | if (!siteUrl.StartsWith("http://") && !siteUrl.StartsWith("https://")) 18 | { 19 | siteUrl = "http://" + siteUrl; 20 | } 21 | Uri uri = new Uri(siteUrl); 22 | return uri.PathAndQuery=="/"; 23 | } 24 | catch 25 | { 26 | return false; 27 | } 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Iridescent.Redis/Config/PoolConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Configuration; 2 | 3 | namespace Iridescent.Redis.Config 4 | { 5 | /// 6 | /// 功能:Redis连接池配置结点 7 | /// 作者:娄晨 8 | /// 日期:2014-5-20 9 | /// 10 | public class PoolConfig:ConfigurationElement 11 | { 12 | [ConfigurationProperty("name", IsRequired = true)] 13 | public string Name 14 | { 15 | get { return this["name"].ToString(); } 16 | } 17 | 18 | [ConfigurationProperty("weight", IsRequired = true)] 19 | public int Weight 20 | { 21 | get { return int.Parse(this["weight"].ToString()); } 22 | } 23 | 24 | [ConfigurationProperty("hosts", IsRequired = true)] 25 | public string Hosts 26 | { 27 | get { return this["hosts"].ToString(); } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Etc/T-SQL/JoinIdToTable.sql: -------------------------------------------------------------------------------- 1 | 2 | SET ANSI_NULLS ON 3 | GO 4 | SET QUOTED_IDENTIFIER ON 5 | GO 6 | 7 | -- ============================================= 8 | ALTER FUNCTION dbo.JoinIdToTable 9 | ( 10 | @JoinId VARCHAR(1000) 11 | ) 12 | RETURNS @IdList TABLE ( 13 | Id INT, 14 | RowNumber INT 15 | ) 16 | AS 17 | BEGIN 18 | 19 | DECLARE @Pos INT; 20 | DECLARE @StrId varchar(20); 21 | SET @Pos=1; 22 | DECLARE @RowNumber INT; 23 | SET @RowNumber=1; 24 | 25 | WHILE(@Pos<>0) 26 | BEGIN 27 | 28 | SET @Pos=CHARINDEX(',',@JoinId); 29 | IF @Pos=0 30 | SET @StrId=@JoinId; 31 | ELSE 32 | SET @StrId=SUBSTRING(@JoinId,1,@Pos-1); 33 | 34 | SET @JoinId=STUFF(@JoinId,1,@Pos,''); 35 | IF(ISNUMERIC(@StrId)=1) 36 | BEGIN 37 | INSERT INTO @IdList VALUES(CAST(@StrId AS INT),@RowNumber) 38 | SET @RowNumber=@RowNumber+1; 39 | END 40 | 41 | END 42 | 43 | RETURN 44 | 45 | END 46 | 47 | GO 48 | -------------------------------------------------------------------------------- /Utils/Common/ValueConverter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Iridescent.Utils.Common 4 | { 5 | public static class ValueConverter 6 | { 7 | public static T Parse(string s, T failedValue = default(T), bool rethrow = false) where T : IConvertible 8 | { 9 | T result = failedValue; 10 | if(string.IsNullOrWhiteSpace(s) && !rethrow) 11 | return result; 12 | 13 | try 14 | { 15 | var convertible = (IConvertible)s; 16 | object typeObj = convertible.ToType(typeof(T), System.Globalization.CultureInfo.InvariantCulture); 17 | result = (T)typeObj; 18 | } 19 | catch 20 | { 21 | if (rethrow) 22 | { 23 | throw; 24 | } 25 | } 26 | return result; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Etc/QueuePrototype/QueuePrototype.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QueuePrototype", "QueuePrototype\QueuePrototype.csproj", "{11335624-C82C-4E0F-9C04-EB14752DF33F}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|x86 = Debug|x86 9 | Release|x86 = Release|x86 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {11335624-C82C-4E0F-9C04-EB14752DF33F}.Debug|x86.ActiveCfg = Debug|x86 13 | {11335624-C82C-4E0F-9C04-EB14752DF33F}.Debug|x86.Build.0 = Debug|x86 14 | {11335624-C82C-4E0F-9C04-EB14752DF33F}.Release|x86.ActiveCfg = Release|x86 15 | {11335624-C82C-4E0F-9C04-EB14752DF33F}.Release|x86.Build.0 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /Examples/Default.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Web.UI; 6 | using System.Web.UI.WebControls; 7 | 8 | namespace Examples 9 | { 10 | public partial class _Default : System.Web.UI.Page 11 | { 12 | protected void Page_Load(object sender, EventArgs e) 13 | { 14 | Session["abc"] = "sessionValue"; 15 | Iridescent.Ajax.Utility.RegisterType(typeof(_Default)); 16 | Iridescent.Ajax.Utility.RegisterType(typeof(Ajax)); 17 | } 18 | 19 | [Iridescent.Ajax.AjaxMethod] 20 | public string GetServerTime(string test) 21 | { 22 | return DateTime.Now.ToString()+", "+test; 23 | } 24 | 25 | [Iridescent.Ajax.AjaxMethod(Iridescent.Ajax.HttpSessionState.ReadOnly)] 26 | public string GetSessionValue() 27 | { 28 | return Session["abc"].ToString(); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /Iridescent.JobService/Common/EmailUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Configuration; 2 | using Iridescent.Utils.FluentEmail; 3 | 4 | namespace Iridescent.JobService.Common 5 | { 6 | internal static class EmailUtils 7 | { 8 | /// 9 | /// 发送通知给服务维护人员 10 | /// 11 | /// 12 | /// 13 | /// 14 | public static void SendToMaintainer(string subject,string body,bool isHtml=true) 15 | { 16 | string maintainer = ConfigurationManager.AppSettings["mailReceiver"]; 17 | if(!string.IsNullOrEmpty(maintainer)) 18 | { 19 | Email.FromDefaultSetting() 20 | .To(maintainer) 21 | .Subject(subject) 22 | .Body(body, isHtml) 23 | .Send(); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Data.Hibernate/MappingFiles/Brand.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Examples/NHibernate/Test.aspx.designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // <自动生成> 3 | // 此代码由工具生成。 4 | // 5 | // 对此文件的更改可能会导致不正确的行为,并且如果 6 | // 重新生成代码,这些更改将会丢失。 7 | // 8 | //------------------------------------------------------------------------------ 9 | 10 | namespace Examples.NHibernate { 11 | 12 | 13 | public partial class Test { 14 | 15 | /// 16 | /// form1 控件。 17 | /// 18 | /// 19 | /// 自动生成的字段。 20 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 21 | /// 22 | protected global::System.Web.UI.HtmlControls.HtmlForm form1; 23 | 24 | /// 25 | /// grdView 控件。 26 | /// 27 | /// 28 | /// 自动生成的字段。 29 | /// 若要进行修改,请将字段声明从设计器文件移到代码隐藏文件。 30 | /// 31 | protected global::System.Web.UI.WebControls.GridView grdView; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Utils/Common/XmlSerializerUtils.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Xml.Serialization; 3 | 4 | namespace Iridescent.Utils.Common 5 | { 6 | public static class XmlSerializerUtils 7 | { 8 | public static T Deserialize(string filePath) where T:class 9 | { 10 | XmlSerializer serializer = new XmlSerializer(typeof(T)); 11 | using (Stream stream = new FileStream(filePath, FileMode.Open, FileAccess.Read)) 12 | { 13 | T result = serializer.Deserialize(stream) as T; 14 | return result; 15 | } 16 | } 17 | 18 | public static void Serializer(string filePath,object obj) 19 | { 20 | XmlSerializer serializer = new XmlSerializer(obj.GetType()); 21 | using (FileStream file = new FileStream(filePath, FileMode.OpenOrCreate, FileAccess.Write)) 22 | { 23 | serializer.Serialize(file, obj); 24 | } 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /OrmUtils/SqlServerOrmQuery.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data; 3 | using System.Data.Common; 4 | using System.Data.SqlClient; 5 | using Iridescent.Data.QueryModel; 6 | using System.Linq; 7 | 8 | namespace Iridescent.OrmExpress 9 | { 10 | internal class SqlServerOrmQuery:OrmQuery 11 | { 12 | public SqlServerOrmQuery(string connectionString) : base(connectionString) 13 | { 14 | } 15 | 16 | protected override IDataReader ExecuteReader(SqlExpressCommand command) 17 | { 18 | if(command.DbParameters==null) 19 | { 20 | return SqlHelper.ExecuteReader(ConnectionString, command.CommandType, command.StatementString); 21 | } 22 | SqlParameter[] sqlParameters = command.DbParameters.Cast().ToArray(); 23 | return SqlHelper.ExecuteReader(ConnectionString, command.CommandType, command.StatementString, 24 | sqlParameters); 25 | } 26 | 27 | } 28 | } -------------------------------------------------------------------------------- /Etc/QueuePrototype/QueuePrototype/OrderProducer.cs: -------------------------------------------------------------------------------- 1 | // Producer 类(使用一个辅助线程) 2 | 3 | // 将项异步添加到队列中,共添加 20 个项。 4 | 5 | using System; 6 | using System.Collections; 7 | using System.Collections.Generic; 8 | 9 | namespace QueuePrototype 10 | { 11 | public class OrderProducer 12 | { 13 | public int ProduceCount { get; private set; } 14 | 15 | public OrderProducer(Queue q, SyncEvents e) 16 | { 17 | 18 | _queue = q; 19 | 20 | _syncEvents = e; 21 | 22 | } 23 | 24 | public void EnqueueOrder(Order order) 25 | { 26 | lock (((ICollection)_queue).SyncRoot) 27 | { 28 | _queue.Enqueue(order); 29 | } 30 | ProduceCount++; 31 | Console.WriteLine(string.Format("Producer Thread:enqueue order of {0} user,create date: {1}", order.UserName, order.CreateDate)); 32 | 33 | _syncEvents.NewItemEvent.Set(); 34 | } 35 | 36 | private Queue _queue; 37 | 38 | private SyncEvents _syncEvents; 39 | 40 | } 41 | } -------------------------------------------------------------------------------- /UnitTest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过下列特性集 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("UnitTest")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("微软中国")] 12 | [assembly: AssemblyProduct("UnitTest")] 13 | [assembly: AssemblyCopyright("Copyright © 微软中国 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的某个类型, 19 | // 则将该类型的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("0c194422-65de-4ced-90db-0991a50159b5")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Examples/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下特性集 6 | // 控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Examples")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("微软中国")] 12 | [assembly: AssemblyProduct("Examples")] 13 | [assembly: AssemblyCopyright("Copyright © 微软中国 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 会使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("72c5558f-793b-48d4-8dce-9e248aa41b47")] 24 | 25 | // 程序集的版本信息由下列四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 您可以指定所有这些值,也可以使用“修订号”和“内部版本号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /Data/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Data")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("微软中国")] 12 | [assembly: AssemblyProduct("Data")] 13 | [assembly: AssemblyCopyright("Copyright © 微软中国 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("f759a954-e859-43f1-a0c2-63c283575aea")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Examples/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 29 | 30 | -------------------------------------------------------------------------------- /Utils/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Utils")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("微软中国")] 12 | [assembly: AssemblyProduct("Utils")] 13 | [assembly: AssemblyCopyright("Copyright © 微软中国 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("1365c2b8-f728-418b-b2b4-f1233ea2d632")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Ajax/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Ajax")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("坎普利特")] 12 | [assembly: AssemblyProduct("Iridescent.Ajax")] 13 | [assembly: AssemblyCopyright("Copyright © 坎普利特 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("9d4f8401-abdf-440d-bb1b-d959a9d69c04")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Entities/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Entities")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("微软中国")] 12 | [assembly: AssemblyProduct("Entities")] 13 | [assembly: AssemblyCopyright("Copyright © 微软中国 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("2808ff4e-a3fa-44b5-84e9-4dc198dc3cf3")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /OrmUtils/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("OrmUtils")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("微软中国")] 12 | [assembly: AssemblyProduct("OrmUtils")] 13 | [assembly: AssemblyCopyright("Copyright © 微软中国 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("2fada6e8-afa7-439c-84df-60bfee6032dc")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /WebControls/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("WebControls")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("微软中国")] 12 | [assembly: AssemblyProduct("WebControls")] 13 | [assembly: AssemblyCopyright("Copyright © 微软中国 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("4bb46ed0-ebdb-4638-8d69-1be47b4c184d")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Data.Hibernate/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Data.Hibernate")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("微软中国")] 12 | [assembly: AssemblyProduct("Data.Hibernate")] 13 | [assembly: AssemblyCopyright("Copyright © 微软中国 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("47f36eee-68b4-408a-bc69-5221fc58f0b8")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Iridescent.Cache/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Iridescent.Cache")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Iridescent.Cache")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("e21060e2-79bc-46c3-9178-21bbec259e20")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Data/DataAccessProviderFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Configuration; 2 | using System.Reflection; 3 | 4 | namespace Iridescent.Data 5 | { 6 | /// 7 | /// Summary description for DataAccessProviderFactory. 8 | /// 9 | public class DataAccessProviderFactory : IDataProviderFactory 10 | { 11 | private static Assembly activeProvider = null; 12 | private static IDataProviderFactory activeDataProviderFactory = null; 13 | 14 | static DataAccessProviderFactory() 15 | { 16 | string providerName = ConfigurationManager.AppSettings["DataProvider"]; 17 | string providerFactoryName = ConfigurationManager.AppSettings["DataProviderFactory"]; 18 | activeProvider = Assembly.Load(providerName); 19 | activeDataProviderFactory = (IDataProviderFactory) activeProvider.CreateInstance(providerFactoryName); 20 | } 21 | 22 | public IDataContext GetDataContext() 23 | { 24 | return activeDataProviderFactory.GetDataContext(); 25 | } 26 | 27 | public static IDataContext CreateDataContext() 28 | { 29 | return activeDataProviderFactory.GetDataContext(); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Utils/Common/DateTimeUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Iridescent.Utils.Common 4 | { 5 | public static class DateTimeUtils 6 | { 7 | /// 8 | /// 计算两个时间相差的年份,结果为周年 9 | /// 10 | /// 11 | /// 12 | /// 13 | public static int DiffYearWithFloor(DateTime dateTime1, DateTime dateTime2) 14 | { 15 | int year = Math.Abs(dateTime1.Year - dateTime2.Year); 16 | if (year != 0 && (dateTime1.Month != dateTime2.Month || dateTime1.Day != dateTime2.Day)) 17 | { 18 | bool isTime1HasLaterDay = dateTime1.Month > dateTime2.Month || 19 | (dateTime1.Month == dateTime2.Month && dateTime1.Day > dateTime2.Day); 20 | if (isTime1HasLaterDay) 21 | year += dateTime1.Year > dateTime2.Year ? 0 : -1; 22 | else 23 | year += dateTime1.Year > dateTime2.Year ? -1 : 0; 24 | } 25 | 26 | return year; 27 | } 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Etc/QueuePrototype/QueuePrototype/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("QueuePrototype")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("微软中国")] 12 | [assembly: AssemblyProduct("QueuePrototype")] 13 | [assembly: AssemblyCopyright("Copyright © 微软中国 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("5ca4be61-b014-4c89-8387-46b51921a197")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 内部版本号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Iridescent.DependencyResolution/IObjectContainer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using StructureMap.Configuration.DSL; 4 | using StructureMap.Graph; 5 | 6 | namespace Iridescent.DependencyResolution 7 | { 8 | public interface IObjectContainer 9 | { 10 | T Resolve(); 11 | object Resolve(Type modelType); 12 | IList ResolveAll(Type modelType); 13 | 14 | void Register(Type typeFor, Type typeUse); 15 | void Register(Type typeFor, object instance); 16 | 17 | /// 18 | /// 初始化依赖注入容器 需在调用其他方法之前执行 19 | /// 20 | /// 扫描的程序集 21 | void Init(string[] scanAssembles = null); 22 | 23 | /// 24 | /// 初始化依赖注入容器 需在调用其他方法之前执行 25 | /// 26 | /// 扫描的程序集 27 | /// 注入条目对象 28 | /// 条目转换对象 29 | void Init(string[] scanAssembles , Registry[] registries, IRegistrationConvention[] conventions); 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Iridescent.Memcached/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Iridescent.Memcached")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Iridescent.Memcached")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("373204fe-6325-444a-930e-276890021d94")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Examples/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 17 | 18 | 19 | 30 | 31 | -------------------------------------------------------------------------------- /Examples.IService/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Examples.IService")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Examples.IService")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("f0b15e2c-8712-49ca-9611-1ea8c9a71d3a")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Examples.Service/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Examples.Service")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Examples.Service")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("9e01e6c7-4785-4148-8154-dc770dfa0feb")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Iridescent.Redis/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Iridescent.Redis")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Iridescent.Redis")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("99df145a-716e-40fa-aaaf-2f8534e16c5e")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /OrmUtils/PrimaryKeyFinder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | 4 | namespace Iridescent.OrmExpress 5 | { 6 | public class PrimaryKeyFinder 7 | { 8 | private const string DefaultPrimaryKey = "Id"; 9 | 10 | public static string GetPrimaryKey() 11 | { 12 | return GetPrimaryKey(typeof (TEntity)); 13 | } 14 | 15 | public static string GetPrimaryKey(Type type) 16 | { 17 | PropertyInfo primaryKeyProperty = GetPrimaryKeyPropertyInfo(type); 18 | return primaryKeyProperty.Name; 19 | } 20 | 21 | public static PropertyInfo GetPrimaryKeyPropertyInfo(Type type) 22 | { 23 | PropertyInfo primaryKeyProperty = ReflectHelper.SearchPropertyInfoFromAttribute(type); 24 | if (primaryKeyProperty == null) 25 | primaryKeyProperty = type.GetProperty(DefaultPrimaryKey, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public|BindingFlags.IgnoreCase); 26 | if (primaryKeyProperty == null) 27 | throw new ArgumentException("无法找到主键属性"); 28 | return primaryKeyProperty; 29 | } 30 | 31 | } 32 | } -------------------------------------------------------------------------------- /Iridescent.JobService/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Iridescent.JobService")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Iridescent.JobService")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("c7ee95e9-69ff-495d-b9e8-7f191de5246d")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Iridescent.CacheHandler/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Iridescent.CacheHandler")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Iridescent.CacheHandler")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("cdcb5ee5-b8a2-4230-a09f-776d34104bc0")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Data.Hibernate/MappingFiles/Diary.hbm.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Iridescent.DependencyResolution/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // 有关程序集的常规信息通过以下 6 | // 特性集控制。更改这些特性值可修改 7 | // 与程序集关联的信息。 8 | [assembly: AssemblyTitle("Iridescent.DependencyResolution")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Iridescent.DependencyResolution")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // 将 ComVisible 设置为 false 使此程序集中的类型 18 | // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, 19 | // 则将该类型上的 ComVisible 特性设置为 true。 20 | [assembly: ComVisible(false)] 21 | 22 | // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID 23 | [assembly: Guid("ff671696-3230-4762-aee2-b186cc176189")] 24 | 25 | // 程序集的版本信息由下面四个值组成: 26 | // 27 | // 主版本 28 | // 次版本 29 | // 生成号 30 | // 修订号 31 | // 32 | // 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, 33 | // 方法是按如下所示使用“*”: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Iridescent.Memcached/MemcachedClientFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Enyim.Caching; 6 | 7 | namespace Iridescent.Memcached 8 | { 9 | internal static class MemcachedClientFactory 10 | { 11 | //MemcachedClient 是一个重量级的对象 每次调用都创建和销毁会降低性能 12 | //https://github.com/enyim/EnyimMemcached/wiki/MemcachedClient-Usage 13 | 14 | private static IMemcachedClient _client; 15 | 16 | static MemcachedClientFactory() 17 | { 18 | _client = Create(); 19 | } 20 | 21 | private static readonly object _syncRoot=new object(); 22 | 23 | /// 24 | /// 使用单例模式 创建MemcachedClient客户端实例 25 | /// 26 | /// 27 | public static IMemcachedClient Create() 28 | { 29 | if(_client==null) 30 | { 31 | lock (_syncRoot) 32 | { 33 | if(_client==null) 34 | { 35 | _client=new MemcachedClient(); 36 | } 37 | } 38 | } 39 | 40 | return _client; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Ajax/ReflectionHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Text; 6 | 7 | namespace Iridescent.Ajax 8 | { 9 | public sealed class ReflectionHelper 10 | { 11 | ReflectionHelper(){} 12 | 13 | public static object ToType(Type type,string value) 14 | { 15 | if (type == typeof(string)) 16 | return value; 17 | 18 | var methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public); 19 | MethodInfo parseMethod = (from method in methods 20 | where method.Name == "Parse" && method.GetParameters().Length == 1 21 | select method).FirstOrDefault(); 22 | if(parseMethod==null) 23 | { 24 | throw new ArgumentException(string.Format("Type: {0} has not Parse static method!",type.ToString())); 25 | } 26 | return parseMethod.Invoke(null, new object[] { value }); 27 | } 28 | 29 | public static object GetDefaultValue(Type type) 30 | { 31 | return type.IsValueType ? Activator.CreateInstance(type) : null; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /OrmUtils/OrmUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | 5 | namespace Iridescent.OrmExpress 6 | { 7 | public sealed class OrmUtils 8 | { 9 | public static TEntity ReadToEntity(IDataReader reader) where TEntity:class 10 | { 11 | if (reader.Read()) 12 | { 13 | TEntity entity = (TEntity)Activator.CreateInstance(typeof(TEntity)); 14 | for (int i = 0; i < reader.FieldCount; i++) 15 | { 16 | if (!reader.IsDBNull(i)) 17 | { 18 | ReflectHelper.SetPropertyValue(entity, reader.GetName(i), reader.GetValue(i)); 19 | } 20 | } 21 | return entity; 22 | } 23 | return null; 24 | } 25 | 26 | public static IList ReadToEntityList(IDataReader reader) where TEntity:class 27 | { 28 | IList list = new List(); 29 | TEntity entity; 30 | while ((entity = ReadToEntity(reader)) != null) 31 | { 32 | list.Add(entity); 33 | } 34 | return list; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Utils/Common/OrmUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | 5 | namespace Iridescent.Utils.Common 6 | { 7 | public sealed class OrmUtils 8 | { 9 | public static TEntity ReadToEntity(IDataReader reader) where TEntity:class 10 | { 11 | if (reader.Read()) 12 | { 13 | TEntity entity = (TEntity)Activator.CreateInstance(typeof(TEntity)); 14 | for (int i = 0; i < reader.FieldCount; i++) 15 | { 16 | if (!reader.IsDBNull(i)) 17 | { 18 | ReflectHelper.SetPropertyValue(entity, reader.GetName(i), reader.GetValue(i)); 19 | } 20 | } 21 | return entity; 22 | } 23 | return null; 24 | } 25 | 26 | public static IList ReadToEntityList(IDataReader reader) where TEntity:class 27 | { 28 | IList list = new List(); 29 | TEntity entity; 30 | while ((entity = ReadToEntity(reader)) != null) 31 | { 32 | list.Add(entity); 33 | } 34 | return list; 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /Utils/Common/StringParseUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Iridescent.Utils.Common 4 | { 5 | public static class StringParseUtils 6 | { 7 | /// 8 | /// 从用符号连接的数字中获得 整型集合 9 | /// 10 | /// 用符号连接的数字 11 | /// 连接字符串的符号 12 | /// 13 | public static IList ParseJoinString(string joinString,char separator) 14 | { 15 | IList result=new List(); 16 | if(!string.IsNullOrEmpty(joinString)) 17 | { 18 | string[] splited = joinString.Split(separator); 19 | foreach (var s in splited) 20 | { 21 | int i; 22 | if(int.TryParse(s,out i)) 23 | result.Add(i); 24 | } 25 | } 26 | return result; 27 | } 28 | 29 | /// 30 | /// 从用逗号链接的数字中获得 整型集合 31 | /// 32 | /// 33 | /// 34 | public static IList ParseCommaJoinString(string joinString) 35 | { 36 | return ParseJoinString(joinString, ','); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /UnitTest/Utils/DateTimeUtilsTest.cs: -------------------------------------------------------------------------------- 1 | using Iridescent.Utils; 2 | using System; 3 | using Iridescent.Utils.Common; 4 | using NUnit.Framework; 5 | 6 | namespace UnitTest.Utils 7 | { 8 | 9 | 10 | /// 11 | ///这是 DateTimeUtilsTest 的测试类,旨在 12 | ///包含所有 DateTimeUtilsTest 单元测试 13 | /// 14 | [TestFixture] 15 | public class DateTimeUtilsTest 16 | { 17 | 18 | /// 19 | ///DiffYearWithFloor 的测试 20 | /// 21 | [Test] 22 | public void DiffYearWithFloorTest() 23 | { 24 | DateTime dateTime1 = new DateTime(1977, 4, 26); 25 | DateTime dateTime2 = new DateTime(2012, 4, 25); 26 | int expected = 34; 27 | int actual; 28 | actual = DateTimeUtils.DiffYearWithFloor(dateTime1, dateTime2); 29 | Assert.AreEqual(expected, actual); 30 | } 31 | 32 | /// 33 | ///DiffYearWithFloor 的测试 34 | /// 35 | [Test] 36 | public void DiffYearWithFloor2Test() 37 | { 38 | DateTime dateTime1 = new DateTime(1995, 4, 4); 39 | DateTime dateTime2 = new DateTime(1993, 4, 2); 40 | int expected = 2; 41 | int actual; 42 | actual = DateTimeUtils.DiffYearWithFloor(dateTime1, dateTime2); 43 | Assert.AreEqual(expected, actual); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /UnitTest/CacheHandler/CachingHandlerTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading; 6 | using Examples.IService; 7 | using Examples.Service; 8 | using Iridescent.CacheHandler; 9 | using Iridescent.DependencyResolution; 10 | using NUnit.Framework; 11 | 12 | namespace UnitTest.CacheHandler 13 | { 14 | [TestFixture] 15 | public class CachingHandlerTest 16 | { 17 | [SetUp] 18 | public void Setup() 19 | { 20 | ContainerFactory.Singleton.Init(new[] { "Examples.IService", "Examples.Service" }); 21 | CacchingAopConfig.Config("Examples.IService"); 22 | } 23 | 24 | [Test] 25 | public void ShouldInjection() 26 | { 27 | ITestService service = ContainerFactory.Singleton.Resolve(); 28 | DateTime currentDate = service.GetCurrentDate(0); 29 | Thread.Sleep(100); 30 | DateTime cacheDate = service.GetCurrentDate(0); 31 | DateTime anotherCacheDate = service.GetCurrentDate(1); 32 | 33 | Console.WriteLine(currentDate); 34 | Console.WriteLine(cacheDate); 35 | Console.WriteLine(anotherCacheDate); 36 | 37 | Assert.AreEqual(currentDate, cacheDate); 38 | Assert.AreNotEqual(cacheDate, anotherCacheDate); 39 | } 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Ajax/EmbeddedJavascriptHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Text; 7 | using System.Web; 8 | 9 | namespace Iridescent.Ajax 10 | { 11 | internal class EmbeddedJavascriptHandler:IHttpHandler 12 | { 13 | private const string FILE_RESOURCE_PREFIX = "Iridescent.Ajax.Script."; 14 | private string _fileName; 15 | 16 | public EmbeddedJavascriptHandler(string fileName) 17 | { 18 | _fileName = fileName; 19 | } 20 | 21 | public void ProcessRequest(HttpContext context) 22 | { 23 | Assembly assembly = Assembly.GetExecutingAssembly(); 24 | string fullFilename = FILE_RESOURCE_PREFIX + _fileName; 25 | Stream resourceStream = assembly.GetManifestResourceStream(fullFilename); 26 | 27 | if (resourceStream != null) 28 | using (StreamReader reader=new StreamReader(resourceStream)) 29 | { 30 | context.Response.AddHeader("Content-Type", "application/x-javascript"); 31 | context.Response.Write(reader.ReadToEnd()); 32 | } 33 | else 34 | { 35 | throw new Exception("名为 "+fullFilename+" 的资源不存在。"); 36 | } 37 | } 38 | 39 | public bool IsReusable 40 | { 41 | get { return false; } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Iridescent.Memcached/MemCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Enyim.Caching; 6 | using Enyim.Caching.Memcached; 7 | using Iridescent.Cache; 8 | 9 | namespace Iridescent.Memcached 10 | { 11 | public class MemCache:ICache 12 | { 13 | private IMemcachedClient _client; 14 | 15 | public MemCache() 16 | { 17 | _client = MemcachedClientFactory.Create(); 18 | } 19 | 20 | public bool Set(string key, object value) 21 | { 22 | return _client.Store(StoreMode.Set, key, value); 23 | } 24 | 25 | public bool Set(string key, object value, DateTime expiresAt) 26 | { 27 | return _client.Store(StoreMode.Set, key, value, expiresAt); 28 | } 29 | 30 | public bool Set(string key, object value, TimeSpan expiresIn) 31 | { 32 | return _client.Store(StoreMode.Set, key, value, expiresIn); 33 | } 34 | 35 | public object Get(string key) 36 | { 37 | return _client.Get(key); 38 | } 39 | 40 | public T Get(string key) 41 | { 42 | return _client.Get(key); 43 | } 44 | 45 | public bool Remove(string key) 46 | { 47 | return _client.Remove(key); 48 | } 49 | 50 | public void FlushAll() 51 | { 52 | _client.FlushAll(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Iridescent.Cache/CacheFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Linq; 5 | using System.Text; 6 | 7 | namespace Iridescent.Cache 8 | { 9 | public static class CacheFactory 10 | { 11 | private static readonly Dictionary DictCacheProviders = new Dictionary(); 12 | 13 | private static readonly object SyncRoot = new object(); 14 | 15 | public static ICache CreateDefault() 16 | { 17 | string cacheProvider = ConfigurationManager.AppSettings["CacheProvider"] ?? string.Empty; 18 | ICache cache = null; 19 | 20 | if (!DictCacheProviders.TryGetValue(cacheProvider, out cache)) 21 | { 22 | lock (SyncRoot) 23 | { 24 | if (!DictCacheProviders.TryGetValue(cacheProvider, out cache)) 25 | { 26 | if (!string.IsNullOrWhiteSpace(cacheProvider)) 27 | { 28 | cache = (ICache)Activator.CreateInstance(Type.GetType(cacheProvider)); 29 | } 30 | else 31 | cache = new WebCache(); 32 | DictCacheProviders.Add(cacheProvider, cache); 33 | } 34 | } 35 | } 36 | 37 | return cache; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /UnitTest/Redis/BinaryRedisCacheTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | using Iridescent.Redis; 7 | using NUnit.Framework; 8 | 9 | namespace UnitTest.Redis 10 | { 11 | [TestFixture] 12 | class BinaryRedisCacheTest 13 | { 14 | [Serializable] 15 | class TestClass 16 | { 17 | public DateTime DateTime { get; set; } 18 | } 19 | 20 | [Test] 21 | public void ShouldCacheUsualType() 22 | { 23 | CacheIt(); 24 | CacheIt("abc"); 25 | CacheIt(); 26 | CacheIt(); 27 | CacheIt(); 28 | CacheIt(); 29 | CacheIt(new StringBuilder("builder")); 30 | CacheIt(new DataTable()); 31 | CacheIt(new DataSet()); 32 | CacheIt(new List(){"abc"}); 33 | CacheIt(new List(){new TestClass()}); 34 | CacheIt(new TestClass()); 35 | } 36 | 37 | private void CacheIt(T value=default(T)) 38 | { 39 | BinaryRedisCache redis=new BinaryRedisCache(); 40 | string key = typeof (T).Name; 41 | redis.Set(key, value, TimeSpan.FromSeconds(10)); 42 | object cacheResult= redis.Get(key); 43 | Console.WriteLine(cacheResult.GetType()+", "+cacheResult); 44 | Assert.AreEqual(typeof(T),cacheResult.GetType()); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /OrmUtils/OrmQuery.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using Iridescent.Data.QueryModel; 5 | 6 | namespace Iridescent.OrmExpress 7 | { 8 | public abstract class OrmQuery 9 | { 10 | public string ConnectionString { get; set; } 11 | 12 | protected OrmQuery(string connectionString) 13 | { 14 | ConnectionString = connectionString; 15 | } 16 | 17 | public TEntity Get(string sqlStatement, Query query = null) where TEntity : class 18 | { 19 | return Get(SqlExpressCommand.Create(sqlStatement, query)); 20 | } 21 | 22 | public TEntity Get(SqlExpressCommand command) where TEntity : class 23 | { 24 | using (IDataReader reader = ExecuteReader(command)) 25 | { 26 | return OrmUtils.ReadToEntity(reader); 27 | } 28 | } 29 | 30 | protected abstract IDataReader ExecuteReader(SqlExpressCommand command); 31 | 32 | public IList GetList(string sqlStatement, Query query = null) where TEntity:class 33 | { 34 | return GetList(SqlExpressCommand.Create(sqlStatement, query)); 35 | } 36 | 37 | public IList GetList(SqlExpressCommand command) where TEntity : class 38 | { 39 | using (IDataReader reader = ExecuteReader(command)) 40 | { 41 | return OrmUtils.ReadToEntityList(reader); 42 | } 43 | } 44 | 45 | } 46 | } -------------------------------------------------------------------------------- /Examples/Cache/Test.aspx.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Web; 7 | using System.Web.UI; 8 | using System.Web.UI.MobileControls; 9 | using System.Web.UI.WebControls; 10 | using Iridescent.Cache; 11 | 12 | namespace Examples.Cache 13 | { 14 | [Serializable] 15 | class MyClass 16 | { 17 | public string A { get; set; } 18 | 19 | public MyClass() 20 | { 21 | A = "a"; 22 | } 23 | 24 | public MyClass Class { get; set; } 25 | 26 | public int B { get; set; } 27 | } 28 | 29 | public partial class Test : System.Web.UI.Page 30 | { 31 | 32 | protected void Page_Load(object sender, EventArgs e) 33 | { 34 | ICache cache = CacheFactory.CreateDefault(); 35 | object obj = cache.Get("key"); 36 | 37 | if(obj==null) 38 | { 39 | obj = new MyClass(); 40 | List objList=new List(){obj as MyClass}; 41 | var sb = (new StringBuilder()).Append("123"); 42 | 43 | DataTable dt=new DataTable(); 44 | dt.Columns.Add("c"); 45 | DataRow row= dt.NewRow(); 46 | row["c"] = DateTime.Now; 47 | dt.Rows.Add(row); 48 | 49 | cache.Set("key",objList ,DateTime.Now.AddSeconds(5)); 50 | } 51 | 52 | Response.Write(cache.Get>("key") + "
"); 53 | 54 | } 55 | } 56 | } -------------------------------------------------------------------------------- /Utils/Common/StreamUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Iridescent.Utils.Common 4 | { 5 | public static class StreamUtils 6 | { 7 | public static byte[] ReadToEnd(System.IO.Stream stream) 8 | { 9 | long originalPosition = stream.Position; 10 | 11 | byte[] readBuffer = new byte[4096]; 12 | 13 | int totalBytesRead = 0; 14 | int bytesRead; 15 | 16 | while ((bytesRead = stream.Read(readBuffer, totalBytesRead, readBuffer.Length - totalBytesRead)) > 0) 17 | { 18 | totalBytesRead += bytesRead; 19 | 20 | if (totalBytesRead == readBuffer.Length) 21 | { 22 | int nextByte = stream.ReadByte(); 23 | if (nextByte != -1) 24 | { 25 | byte[] temp = new byte[readBuffer.Length * 2]; 26 | Buffer.BlockCopy(readBuffer, 0, temp, 0, readBuffer.Length); 27 | Buffer.SetByte(temp, totalBytesRead, (byte)nextByte); 28 | readBuffer = temp; 29 | totalBytesRead++; 30 | } 31 | } 32 | } 33 | 34 | byte[] buffer = readBuffer; 35 | if (readBuffer.Length != totalBytesRead) 36 | { 37 | buffer = new byte[totalBytesRead]; 38 | Buffer.BlockCopy(readBuffer, 0, buffer, 0, totalBytesRead); 39 | } 40 | return buffer; 41 | } 42 | 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Etc/Javascript/easy.layer.demo.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 12 | hover me! 13 | | click me! 14 |
15 | float layer! 16 |
17 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Iridescent.Cache/WebCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Web; 7 | 8 | namespace Iridescent.Cache 9 | { 10 | public class WebCache :ICache 11 | { 12 | 13 | public bool Set(string key, object value) 14 | { 15 | HttpRuntime.Cache.Insert(key,value); 16 | return true; 17 | } 18 | 19 | public bool Set(string key, object value, DateTime expiresAt) 20 | { 21 | HttpRuntime.Cache.Insert(key, value, null, expiresAt, System.Web.Caching.Cache.NoSlidingExpiration); 22 | return true; 23 | } 24 | 25 | public bool Set(string key, object value, TimeSpan expiresIn) 26 | { 27 | Set(key, value, DateTime.Now.Add(expiresIn)); 28 | return true; 29 | } 30 | 31 | public object Get(string key) 32 | { 33 | return HttpRuntime.Cache.Get(key); 34 | } 35 | 36 | public T Get(string key) 37 | { 38 | object obj = Get(key); 39 | return obj != null ? (T)obj : default(T); 40 | } 41 | 42 | public bool Remove(string key) 43 | { 44 | HttpRuntime.Cache.Remove(key); 45 | return true; 46 | } 47 | 48 | public void FlushAll() 49 | { 50 | IDictionaryEnumerator cacheEnumerator = HttpRuntime.Cache.GetEnumerator(); 51 | do 52 | { 53 | HttpRuntime.Cache.Remove(cacheEnumerator.Key.ToString()); 54 | } while (cacheEnumerator.MoveNext()); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Data/QueryModel/CriteriaOperator.cs: -------------------------------------------------------------------------------- 1 | namespace Iridescent.Data.QueryModel 2 | { 3 | /// 4 | /// Specifies the operator of a criterion 5 | /// 6 | public enum CriteriaOperator 7 | { 8 | /// 9 | /// An operator that represents an "equal" criterion. 10 | /// 11 | Equal, 12 | /// 13 | /// An operator that represents a "not equal" criterion. 14 | /// 15 | NotEqual, 16 | /// 17 | /// An operator that represents a "greater than" criterion. 18 | /// 19 | GreaterThan, 20 | /// 21 | /// An operator that represents a "lesser than" criterion. 22 | /// 23 | LesserThan, 24 | /// 25 | /// An operator that represents a "greater than or equal" criterion. 26 | /// 27 | GreaterThanOrEqual, 28 | /// 29 | /// An operator that represents a "lesser than or equal" criterion. 30 | /// 31 | LesserThanOrEqual, 32 | /// 33 | /// An operator that represents a "like" criterion. 34 | /// 35 | Like, 36 | /// 37 | /// An operator that represents a "not like" criterion. 38 | /// 39 | NotLike, 40 | /// 41 | /// An operator that represents a "is null" criterion. 42 | /// 43 | IsNull, 44 | /// 45 | /// An operator that represents a "is not null" criterion. 46 | /// 47 | IsNotNull 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Data/QueryModel/Query Model.cd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | AEAAAAAAAAAAAAACAAAAAAAAAAAAACAAAAAgAABAIAA= 7 | QueryModel\Criterion.cs 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | AAAAAEAAAABAAAACAAAAQAAAIEAAACAAAAAAAAAAIAA= 17 | QueryModel\Query.cs 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | ACAAAAAAAAAAAACAgIAAgAAAAAAAAAAIAAAAEQQBAAA= 30 | QueryModel\CriteriaOperator.cs 31 | 32 | 33 | 34 | 35 | 36 | IAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAA= 37 | QueryModel\QueryOperator.cs 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Etc/T-SQL/PagingView.sql: -------------------------------------------------------------------------------- 1 | CREATE PROCEDURE [dbo].[Common_GetPagingView] 2 | @PageIndex int, -- Note : First page index is 1 3 | @PageSize int, 4 | @TablesName nvarchar(400), 5 | @SelectedFields nvarchar(4000)= '*', 6 | @SortFields nvarchar(200), 7 | @Filter nvarchar(600) = null, 8 | @RecordCount int 9 | as 10 | set nocount on 11 | 12 | declare @PageIndexLowerBound int, @PageIndexUperBound int 13 | set @PageIndexLowerBound = (@PageIndex - 1) * @PageSize + 1 14 | set @PageIndexUperBound = @PageIndexLowerBound + @PageSize - 1 15 | 16 | declare @TopRecords int 17 | set @TopRecords = @PageIndex * @PageSize 18 | 19 | if @SelectedFields = '' 20 | set @SelectedFields = '*' 21 | 22 | if @Filter is null 23 | set @Filter = '' 24 | else if @Filter <> '' 25 | set @Filter = ' where ' + @Filter 26 | 27 | declare @Sql nvarchar(2000) 28 | 29 | set @Sql = N' 30 | ;with PageView_RecordsLimit as ( 31 | select top ' + cast(@TopRecords as nvarchar(50)) + N' ' + 32 | @SelectedFields + ' from ' + @TablesName + @Filter + N' order by ' + @SortFields + N' 33 | ), 34 | PageView_Records as ( 35 | select *, row_number() over (' + N' order by ' + @SortFields + N') as PageView_RowNum 36 | from PageView_RecordsLimit 37 | ) 38 | select * from PageView_Records where PageView_RowNum between ' + 39 | cast(@PageIndexLowerBound as nvarchar(50)) + N' and ' + cast(@PageIndexUperBound as nvarchar(50)) + N' 40 | order by PageView_RowNum asc' 41 | --RAISERROR (@Sql,16,1) 42 | exec sp_executesql @Sql 43 | 44 | if @RecordCount = 0 begin 45 | set @Sql = N'select count(*) as RecordCount from ' + @TablesName + @Filter 46 | exec sp_executesql @Sql 47 | end else 48 | select @RecordCount 49 | 50 | GO 51 | -------------------------------------------------------------------------------- /OrmUtils/ReflectHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Reflection; 4 | 5 | namespace Iridescent.OrmExpress 6 | { 7 | public sealed class ReflectHelper 8 | { 9 | public static string[] GetPropertyNames(Type type) 10 | { 11 | PropertyInfo[] propertyInfos = type.GetProperties(); 12 | return propertyInfos.Select(property => property.Name).ToArray(); 13 | } 14 | 15 | public static Object GetPropertyValue(Object entity,string propertyName) 16 | { 17 | PropertyInfo property= entity.GetType().GetProperty(propertyName); 18 | return property.GetValue(entity, null); 19 | } 20 | 21 | /// 22 | /// 获取类型上含有指定attribute的属性 23 | /// 24 | /// 25 | /// 26 | public static PropertyInfo SearchPropertyInfoFromAttribute(Type type) where TAttribute:Attribute 27 | { 28 | foreach (var propertyInfo in type.GetProperties()) 29 | { 30 | object[] attributes = propertyInfo.GetCustomAttributes(typeof (TAttribute), true); 31 | if (attributes.Length == 1) 32 | return propertyInfo; 33 | } 34 | return null; 35 | } 36 | 37 | public static void SetPropertyValue(object entity, string propertyName, object value) 38 | { 39 | Type type = entity.GetType(); 40 | PropertyInfo propertyInfo = type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.IgnoreCase); 41 | propertyInfo.SetValue(entity,value,null); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Iridescent.JobService/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Iridescent.JobService.Common; 3 | using log4net; 4 | using Topshelf; 5 | 6 | namespace Iridescent.JobService 7 | { 8 | class Program 9 | { 10 | static void Main(string[] args) 11 | { 12 | AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; 13 | 14 | HostFactory.Run(x => 15 | { 16 | x.Service(s => 17 | { 18 | s.ConstructUsing( 19 | name => new QuartzService()); 20 | s.WhenStarted(service => service.Start()); 21 | s.WhenStopped(service => service.Stop()); 22 | }); 23 | x.RunAsLocalSystem(); 24 | 25 | x.SetDescription("service description"); 26 | x.SetDisplayName("job service"); 27 | x.SetServiceName("job service"); 28 | }); 29 | } 30 | 31 | static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) 32 | { 33 | HandleException((Exception)e.ExceptionObject, e.IsTerminating); 34 | } 35 | 36 | static void HandleException(Exception e, bool isTerminating) 37 | { 38 | ILog log = LogManager.GetLogger(typeof(Program)); 39 | log.Fatal("-----------------------Statistics服务出现未捕获异常", e); 40 | 41 | if (isTerminating) 42 | { 43 | EmailUtils.SendToMaintainer("Statistics服务出现异常,非正常终止", 44 | "Statistics服务出现非正常终止,异常如下:
" + e.ToString() + "
"); 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Utils/Common/ReflectHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Reflection; 4 | 5 | namespace Iridescent.Utils.Common 6 | { 7 | public sealed class ReflectHelper 8 | { 9 | public static string[] GetPropertyNames(Type type) 10 | { 11 | PropertyInfo[] propertyInfos = type.GetProperties(); 12 | return propertyInfos.Select(property => property.Name).ToArray(); 13 | } 14 | 15 | public static Object GetPropertyValue(Object entity,string propertyName) 16 | { 17 | PropertyInfo property= entity.GetType().GetProperty(propertyName); 18 | return property.GetValue(entity, null); 19 | } 20 | 21 | /// 22 | /// 获取类型上含有指定attribute的属性 23 | /// 24 | /// 25 | /// 26 | public static PropertyInfo SearchPropertyInfoFromAttribute(Type type) where TAttribute:Attribute 27 | { 28 | foreach (var propertyInfo in type.GetProperties()) 29 | { 30 | object[] attributes = propertyInfo.GetCustomAttributes(typeof (TAttribute), true); 31 | if (attributes.Length == 1) 32 | return propertyInfo; 33 | } 34 | return null; 35 | } 36 | 37 | public static void SetPropertyValue(object entity, string propertyName, object value) 38 | { 39 | Type type = entity.GetType(); 40 | PropertyInfo propertyInfo = type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.IgnoreCase); 41 | propertyInfo.SetValue(entity,value,null); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Etc/QueuePrototype/QueuePrototype/SyncEvents.cs: -------------------------------------------------------------------------------- 1 | using System.Threading; 2 | 3 | // 将线程同步事件封装在此类中, 4 | 5 | // 以便于将这些事件传递给 Consumer 和 6 | 7 | // Producer 类。 8 | 9 | namespace QueuePrototype 10 | { 11 | public class SyncEvents 12 | { 13 | 14 | public SyncEvents() 15 | { 16 | 17 | // AutoResetEvent 用于“新项”事件,因为 18 | 19 | // 我们希望每当使用者线程响应此事件时, 20 | 21 | // 此事件就会自动重置。 22 | 23 | _newItemEvent = new AutoResetEvent(false); 24 | 25 | 26 | // ManualResetEvent 用于“退出”事件,因为 27 | 28 | // 我们希望发出此事件的信号时有多个线程响应。 29 | 30 | // 如果使用 AutoResetEvent,事件 31 | 32 | // 对象将在单个线程作出响应之后恢复为 33 | 34 | // 未发信号的状态,而其他线程将 35 | 36 | // 无法终止。 37 | 38 | _exitThreadEvent = new ManualResetEvent(false); 39 | 40 | 41 | // 这两个事件也放在一个 WaitHandle 数组中,以便 42 | 43 | // 使用者线程可以使用 WaitAny 方法 44 | 45 | // 阻塞这两个事件。 46 | 47 | _eventArray = new WaitHandle[2]; 48 | 49 | _eventArray[0] = _newItemEvent; 50 | 51 | _eventArray[1] = _exitThreadEvent; 52 | 53 | } 54 | 55 | 56 | // 公共属性允许对事件进行安全访问。 57 | 58 | public EventWaitHandle ExitThreadEvent 59 | { 60 | 61 | get { return _exitThreadEvent; } 62 | 63 | } 64 | 65 | public EventWaitHandle NewItemEvent 66 | { 67 | 68 | get { return _newItemEvent; } 69 | 70 | } 71 | 72 | public WaitHandle[] EventArray 73 | { 74 | 75 | get { return _eventArray; } 76 | 77 | } 78 | 79 | 80 | private EventWaitHandle _newItemEvent; 81 | 82 | private EventWaitHandle _exitThreadEvent; 83 | 84 | private WaitHandle[] _eventArray; 85 | 86 | } 87 | } -------------------------------------------------------------------------------- /Ajax/Utility.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Web; 7 | using System.Web.UI; 8 | 9 | namespace Iridescent.Ajax 10 | { 11 | public sealed class Utility 12 | { 13 | Utility(){} 14 | 15 | internal static Hashtable UrlNamespaceMappings; 16 | const string URL_PREFIX = "/Iridescent/Ajax/"; 17 | 18 | static Utility() 19 | { 20 | UrlNamespaceMappings=new Hashtable(); 21 | } 22 | 23 | public static void RegisterType(Type type) 24 | { 25 | RegisterType(type,(Page)HttpContext.Current.Handler); 26 | } 27 | 28 | public static void RegisterType(Type type,Page page) 29 | { 30 | RegisterCommonScript(page); 31 | string typeAndAssemblyName = type.FullName + "," + type.Assembly.GetName().Name; 32 | if(!UrlNamespaceMappings.ContainsKey(typeAndAssemblyName)) 33 | { 34 | UrlNamespaceMappings.Add(typeAndAssemblyName,type.AssemblyQualifiedName); 35 | } 36 | RegisterClientScriptBlock(page,typeAndAssemblyName,URL_PREFIX+typeAndAssemblyName+".ashx"); 37 | } 38 | 39 | internal static void RegisterCommonScript(Page page) 40 | { 41 | RegisterClientScriptBlock(page, "Ajax.Core", URL_PREFIX+"Core.ashx"); 42 | } 43 | 44 | internal static void RegisterClientScriptBlock(Page page,string key,string url) 45 | { 46 | if(!page.ClientScript.IsClientScriptBlockRegistered(key)) 47 | { 48 | page.ClientScript.RegisterClientScriptBlock(page.GetType(), 49 | key, ""); 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Iridescent.Redis/RedisFactory.cs: -------------------------------------------------------------------------------- 1 | using System.Configuration; 2 | using Iridescent.Redis.Config; 3 | using ServiceStack.Redis; 4 | 5 | namespace Iridescent.Redis 6 | { 7 | /// 8 | /// 功能:Redis客户端工厂 9 | /// 作者:娄晨 10 | /// 日期:2014-5-20 11 | /// 12 | public static class RedisFactory 13 | { 14 | /// 15 | /// Redis客户端连接分区管理对象 (利用一致性哈希算法提供客户端连接分区) 16 | /// 17 | private static readonly AutoDetectShardedRedisClientManager RedisClientManager; 18 | 19 | static RedisFactory() 20 | { 21 | var redisConfig = ConfigurationManager.GetSection("redis") as RedisConfigurationSection; 22 | if (redisConfig != null) 23 | { 24 | var connectionPools = new ShardedConnectionPool[redisConfig.Pools.Count]; 25 | int index = 0; 26 | foreach (PoolConfig poolConfig in redisConfig.Pools) 27 | { 28 | connectionPools[index] = new ShardedConnectionPool(poolConfig.Name, poolConfig.Weight, 29 | poolConfig.Hosts); 30 | index++; 31 | } 32 | RedisClientManager = new AutoDetectShardedRedisClientManager(connectionPools); 33 | } 34 | } 35 | 36 | /// 37 | /// 通过Key映射得到RedisClient对象 38 | /// 39 | /// 40 | /// 41 | public static IRedisClient CreateClient(string key) 42 | { 43 | if (RedisClientManager == null) 44 | return null; 45 | 46 | ShardedConnectionPool pool= RedisClientManager.GetConnectionPool(key); //通过key映射到指定的连接池 47 | return pool != null ? pool.GetClient() : null; 48 | } 49 | } 50 | } -------------------------------------------------------------------------------- /Iridescent.CacheHandler/CachingInterceptor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Text; 6 | using System.Threading; 7 | using Castle.DynamicProxy; 8 | using Iridescent.Cache; 9 | using Snap; 10 | 11 | namespace Iridescent.CacheHandler 12 | { 13 | public class CachingInterceptor : MethodInterceptor 14 | { 15 | 16 | private ICacheKeyGenerator _keyGenerator; 17 | 18 | public CachingInterceptor() 19 | { 20 | _keyGenerator = new DefaultCacheKeyGenerator(); 21 | } 22 | 23 | public override void InterceptMethod(IInvocation invocation, MethodBase method, Attribute attribute) 24 | { 25 | CachingAttribute cachingAttribute = attribute as CachingAttribute; 26 | if (cachingAttribute == null) 27 | { 28 | invocation.Proceed(); 29 | } 30 | else 31 | { 32 | string cacheKey = _keyGenerator.CreateCacheKey(method, invocation.Arguments); 33 | object cachedResult = CacheManager.Get(cacheKey); 34 | if(cachedResult==null) 35 | { 36 | lock (method) 37 | { 38 | cachedResult = CacheManager.Get(cacheKey); 39 | if (cachedResult == null) 40 | { 41 | invocation.Proceed(); 42 | cachedResult = invocation.ReturnValue; 43 | CacheManager.Set(cacheKey, cachedResult, cachingAttribute.CacheTimeSpan); 44 | } 45 | } 46 | } 47 | 48 | invocation.ReturnValue = cachedResult; 49 | } 50 | 51 | } 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Data/QueryModel/OrderClause.cs: -------------------------------------------------------------------------------- 1 | namespace Iridescent.Data.QueryModel 2 | { 3 | /// 4 | /// Represents an order imposed upon a result set. 5 | /// 6 | public class OrderClause 7 | { 8 | private string propertyName; 9 | private OrderClauseCriteria criterion; 10 | 11 | /// 12 | /// Initializes a new instance of the Idiorm.OrderClause class. 13 | /// 14 | /// The name of the property to order for. 15 | /// The operator of the new Idiorm.OrderClause object. 16 | public OrderClause(string propertyName, OrderClauseCriteria criteria) 17 | { 18 | this.propertyName = propertyName; 19 | this.criterion = criteria; 20 | } 21 | 22 | /// 23 | /// Gets the name of the property to map 24 | /// 25 | public string PropertyName 26 | { 27 | get 28 | { 29 | return propertyName; 30 | } 31 | } 32 | 33 | /// 34 | /// Gets the ordering criterion of the clause 35 | /// 36 | public OrderClauseCriteria Criterion 37 | { 38 | get 39 | { 40 | return criterion; 41 | } 42 | } 43 | 44 | /// 45 | /// Specifies the criterion of a Idiorm.OrderClause 46 | /// 47 | public enum OrderClauseCriteria 48 | { 49 | /// 50 | /// An operator that represents an "ascending" criterion. 51 | /// 52 | Ascending, 53 | /// 54 | /// An operator that represents a "descending" criterion. 55 | /// 56 | Descending 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /Ajax/AjaxHandlerFactory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Text; 7 | using System.Web; 8 | 9 | namespace Iridescent.Ajax 10 | { 11 | public class AjaxHandlerFactory : IHttpHandlerFactory 12 | { 13 | public IHttpHandler GetHandler(HttpContext context, string requestType, string url, string pathTranslated) 14 | { 15 | string fileWithoutExtensions = Path.GetFileNameWithoutExtension(url); 16 | if (Utility.UrlNamespaceMappings.ContainsKey(fileWithoutExtensions)) 17 | { 18 | bool isPost = requestType == "POST"; 19 | Type type = Type.GetType(fileWithoutExtensions, true, true); 20 | if (isPost) 21 | { 22 | string method = context.Request.Headers["X-IridescentAjax-Method"]; 23 | MethodInfo methodInfo = type.GetMethod(method); 24 | AjaxMethodAttribute[] attributes=(AjaxMethodAttribute[])methodInfo.GetCustomAttributes(typeof (AjaxMethodAttribute), true); 25 | switch (attributes[0].SessionState) 26 | { 27 | case HttpSessionState.None: 28 | return new AjaxProcessorHttpHandler(type); 29 | case HttpSessionState.ReadWrite: 30 | return new AjaxProcessorHttpHandlerSession(type); 31 | case HttpSessionState.ReadOnly: 32 | return new AjaxProcessorHttpHandlerSessionReadOnly(type); 33 | } 34 | } 35 | return new TypeJavascriptHandler(type); 36 | } 37 | return new EmbeddedJavascriptHandler("Core.js"); 38 | } 39 | 40 | public void ReleaseHandler(IHttpHandler handler) 41 | { 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Examples/Default.aspx: -------------------------------------------------------------------------------- 1 | <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Examples._Default" %> 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 |
12 |
13 |
14 |
15 |
16 | 17 |
18 |
19 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Iridescent.CacheHandler/DefaultCacheKeyGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Text; 7 | using System.Web.UI; 8 | 9 | namespace Iridescent.CacheHandler 10 | { 11 | class DefaultCacheKeyGenerator : ICacheKeyGenerator 12 | { 13 | private readonly LosFormatter serializer = new LosFormatter(false, ""); 14 | 15 | public string CreateCacheKey(MethodBase method, object[] inputs) 16 | { 17 | try 18 | { 19 | var sb = new StringBuilder(); 20 | 21 | if (method.DeclaringType != null) 22 | { 23 | sb.Append(method.DeclaringType.FullName); 24 | } 25 | sb.Append(':'); 26 | sb.Append(method.Name); 27 | 28 | TextWriter writer = new StringWriter(sb); 29 | 30 | if (inputs != null) 31 | { 32 | foreach (var input in inputs) 33 | { 34 | sb.Append(':'); 35 | if (input != null) 36 | { 37 | //可空DateTime序列化时存在问题 直接使用Ticks 38 | var inputDateTime = input as DateTime?; 39 | if (inputDateTime.HasValue) 40 | { 41 | sb.Append(inputDateTime.Value.Ticks); 42 | } 43 | else 44 | { 45 | //将参数序列化到stringbuilder 46 | serializer.Serialize(writer, input); 47 | } 48 | } 49 | } 50 | } 51 | 52 | return sb.ToString(); 53 | } 54 | catch 55 | { 56 | return null; 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Data/QueryModel/Query.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace Iridescent.Data.QueryModel 4 | { 5 | public sealed class Query 6 | { 7 | private IList _criteria; 8 | private QueryOperator @operator; 9 | private IList _subQueries = new List(); 10 | private IList _orderClauses; 11 | 12 | public Query(IList criteria, IList orderClauses = null) 13 | { 14 | _criteria = criteria ?? new List(); 15 | _orderClauses = orderClauses ?? new List(); 16 | } 17 | 18 | public Query(IList orderClauses) 19 | : this(null, orderClauses) 20 | { 21 | } 22 | 23 | public Query(Criterion criterion, OrderClause orderClause = null) 24 | : this(criterion == null ? null : new List { criterion }, orderClause == null ? null : new List { orderClause }) 25 | { 26 | } 27 | 28 | public Query(OrderClause orderClause) 29 | : this(null, orderClause) 30 | { 31 | } 32 | 33 | public Query():this(new List(),new List()) 34 | { 35 | 36 | } 37 | 38 | public IList Criteria 39 | { 40 | get 41 | { 42 | return _criteria; 43 | } 44 | } 45 | 46 | public QueryOperator Operator 47 | { 48 | get 49 | { 50 | return @operator; 51 | } 52 | set 53 | { 54 | @operator = value; 55 | } 56 | } 57 | 58 | public IList SubQueries 59 | { 60 | get 61 | { 62 | return _subQueries; 63 | } 64 | } 65 | 66 | public IList OrderClauses 67 | { 68 | get 69 | { 70 | return _orderClauses; 71 | } 72 | } 73 | } 74 | 75 | } -------------------------------------------------------------------------------- /TraceAndTestImpact.testsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 这些设置为跟踪和测试影响的测试设置。 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Etc/QueuePrototype/QueuePrototype/ClassDiagram1.cd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | AAAAAAAAAAAAAABAAAAAAAAAAAAACAAAAQABAAAAAAA= 7 | Order.cs 8 | 9 | 10 | 11 | 12 | 13 | AAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAIAAAAgAgAAAA= 14 | OrderConsumer.cs 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | AAAAAAAAAAEAAAAAEBAAAAAAAAAAAAAIAAAAAAAAAAA= 27 | OrderProducer.cs 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | gAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAAAAABCAAAAA= 40 | Program.cs 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | IAAAAAAAAAAAQQAAAAAAEAAEAAgAAAAAAAAAAAAAAAA= 51 | SyncEvents.cs 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /UnitTest/OrmExpress/SqlCommandGeneratorTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Iridescent.Data.QueryModel; 3 | using Iridescent.Entities; 4 | using Iridescent.OrmExpress; 5 | using NUnit.Framework; 6 | 7 | namespace UnitTest.OrmExpress 8 | { 9 | 10 | [TestFixture] 11 | public class SqlCommandGeneratorTest 12 | { 13 | public SqlCommandGeneratorTest() 14 | { 15 | } 16 | 17 | [Test] 18 | public void GenerateSelectCommand() 19 | { 20 | GenerateCommand("R"); 21 | } 22 | 23 | private string GenerateCommand(string type) 24 | { 25 | ISqlExpressCommandGenerator commandGenerator = SqlExpressCommandGeneratorFactory.Create(); 26 | Query query = new Query(); 27 | query.Criteria.Add(new Criterion("GoodsName", CriteriaOperator.Like, "marcus")); 28 | Query subQuery = new Query(); 29 | query.SubQueries.Add(subQuery); 30 | query.Operator = QueryOperator.Or; 31 | subQuery.Criteria.Add(new Criterion("GoodsId", CriteriaOperator.GreaterThan, 90000)); 32 | SqlExpressCommand command=null; 33 | if (type == "R") 34 | command = commandGenerator.GenerateSelectCommand(query); 35 | else if (type == "D") 36 | command = commandGenerator.GenerateDeleteCommand(query); 37 | return command.Statement.ToString(); 38 | } 39 | 40 | [Test] 41 | public void GenerateDeleteCommand() 42 | { 43 | GenerateCommand("D"); 44 | } 45 | 46 | [Test] 47 | public void GenerateUpdateCommand() 48 | { 49 | Goods goods=new Goods(); 50 | SqlExpressCommand command = SqlExpressCommandGeneratorFactory.Create().GenerateUpdateCommand(goods); 51 | Console.WriteLine(command.Statement.ToString()); 52 | } 53 | 54 | [Test] 55 | public void GenerateInsertCommand() 56 | { 57 | Goods goods = new Goods(); 58 | SqlExpressCommand command = SqlExpressCommandGeneratorFactory.Create().GenerateInsertCommand(goods); 59 | Console.WriteLine(command.Statement.ToString()); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /packages/SNAP.StructureMap.1.8/content/StructureMapAopSample.cs.pp: -------------------------------------------------------------------------------- 1 | 2 | using System; 3 | using System.Reflection; 4 | using Castle.DynamicProxy; 5 | using Snap.StructureMap; 6 | using StructureMap; 7 | using Snap; 8 | 9 | namespace ConsoleApplication1 10 | { 11 | // 12 | // NOTE: Use this sample as follows: SampleStructureMapAopConfig.Intercept() 13 | // 14 | 15 | public static class SampleStructureMapAopConfig 16 | { 17 | static SampleStructureMapAopConfig() 18 | { 19 | SnapConfiguration.For(c => 20 | { 21 | c.IncludeNamespace("ConsoleApplication1*"); 22 | c.Bind().To(); 23 | }); 24 | 25 | ObjectFactory.Configure(c => c.For().Use()); 26 | } 27 | 28 | public static void Intercept() 29 | { 30 | var instance = ObjectFactory.GetInstance(); 31 | instance.Run(); 32 | } 33 | } 34 | 35 | 36 | public interface ISampleClass 37 | { 38 | void Run(); 39 | } 40 | 41 | public class SampleClass : ISampleClass 42 | { 43 | [Sample] // Don't forget your attribute! 44 | public void Run() 45 | { 46 | Console.WriteLine("inside the method"); 47 | } 48 | } 49 | 50 | public class SampleInterceptor : MethodInterceptor 51 | { 52 | public override void BeforeInvocation() 53 | { 54 | Console.WriteLine("this is executed before your method"); 55 | base.BeforeInvocation(); 56 | } 57 | 58 | public override void InterceptMethod(IInvocation invocation, MethodBase method, Attribute attribute) 59 | { 60 | // Just keep running for this demo. 61 | invocation.Proceed(); // the underlying method call 62 | } 63 | 64 | public override void AfterInvocation() 65 | { 66 | Console.WriteLine("this is executed after your method"); 67 | base.AfterInvocation(); 68 | } 69 | } 70 | 71 | public class SampleAttribute : MethodInterceptAttribute 72 | { } 73 | } 74 | -------------------------------------------------------------------------------- /Lib/NHibernate/NHibernate.ByteCode.Castle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NHibernate.ByteCode.Castle 5 | 6 | 7 | 8 | 9 | A for use with the Castle Dynamic Class Generator. 10 | 11 | 12 | 13 | 14 | Initializes a new object. 15 | 16 | 17 | The Class to Proxy. 18 | The Id of the Object we are Proxying. 19 | 20 | 21 | 22 | The ISession this Proxy is in. 23 | 24 | 25 | 26 | Invoke the actual Property/Method using the Proxy or instantiate the actual 27 | object and use it when the Proxy can't handle the method. 28 | 29 | The from the generated Castle.DynamicProxy. 30 | 31 | 32 | 33 | Build a proxy using the Castle.DynamicProxy library. 34 | 35 | The value for the Id. 36 | The Session the proxy is in. 37 | A fully built INHibernateProxy. 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Utils/DataAccess/DapperUtils.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Data; 3 | using System.Data.SqlClient; 4 | using System.Linq; 5 | using Dapper; 6 | 7 | namespace Iridescent.Utils.DataAccess 8 | { 9 | public static class DapperUtils 10 | { 11 | /// 12 | /// 执行参数化SQL 13 | /// 14 | /// 受影响的行数 15 | public static int Execute(string connectionString, string sql, object param, 16 | CommandType commandType = CommandType.Text) 17 | { 18 | using (IDbConnection cnn = new SqlConnection(connectionString)) 19 | { 20 | return SqlMapper.Execute(cnn, sql, param, null, null, commandType); 21 | } 22 | } 23 | 24 | /// 25 | /// 执行查询, 返回指定的T数据类型 26 | /// 27 | public static IList Query(string connectionString, string sql, object param, 28 | CommandType commandType = CommandType.Text) 29 | { 30 | using (IDbConnection cnn = new SqlConnection(connectionString)) 31 | { 32 | return SqlMapper.Query(cnn, sql, param, null, true, null, commandType).ToList(); 33 | } 34 | } 35 | 36 | /// 37 | /// 执行查询返回多结果集, 可依次访问 38 | /// 39 | public static SqlMapper.GridReader QueryMultiple(string connectionString, string sql, object param, 40 | CommandType commandType = CommandType.Text) 41 | { 42 | using (IDbConnection cnn = new SqlConnection(connectionString)) 43 | { 44 | return SqlMapper.QueryMultiple(cnn, sql, param, null, null, commandType); 45 | } 46 | } 47 | 48 | /// 49 | /// 执行查询,返回一个动态对象列表 50 | /// 51 | public static IList Query(string connectionString, string sql, object param, 52 | CommandType? commandType = CommandType.Text) 53 | { 54 | using (IDbConnection cnn = new SqlConnection(connectionString)) 55 | { 56 | return SqlMapper.Query(cnn, sql, param, null, true, null, commandType).ToList(); 57 | } 58 | } 59 | 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Data/QueryModel/Criterion.cs: -------------------------------------------------------------------------------- 1 | namespace Iridescent.Data.QueryModel 2 | { 3 | public class Criterion 4 | { 5 | private string propertyName; 6 | private object value; 7 | private CriteriaOperator @operator; 8 | 9 | /// 10 | /// Initializes a new instance of the Idiorm.Criterion class. 11 | /// 12 | public Criterion() 13 | { 14 | } 15 | 16 | /// 17 | /// Initializes a new instance of the Idiorm.Criterion class that uses the property name, the value and the operator of the new Idiorm.Criterion. 18 | /// 19 | /// The name of the property to map. 20 | /// The operator of the new Idiorm.Criterion object. 21 | /// The value of the new Idiorm.Criterion object. 22 | public Criterion(string propertyName, CriteriaOperator @operator, object value) 23 | : this() 24 | { 25 | this.propertyName = propertyName; 26 | this.value = value; 27 | this.@operator = @operator; 28 | } 29 | 30 | /// 31 | /// Gets or sets the name of the property to be used by the criterion 32 | /// 33 | public string PropertyName 34 | { 35 | get 36 | { 37 | return propertyName; 38 | } 39 | set 40 | { 41 | propertyName = value; 42 | } 43 | } 44 | 45 | /// 46 | /// Gets or sets the value of the criterion 47 | /// 48 | public object Value 49 | { 50 | get 51 | { 52 | return value; 53 | } 54 | set 55 | { 56 | this.value = value; 57 | } 58 | } 59 | 60 | /// 61 | /// Gets or sets the operator of the criterion 62 | /// 63 | public CriteriaOperator Operator 64 | { 65 | get 66 | { 67 | return @operator; 68 | } 69 | set 70 | { 71 | @operator = value; 72 | } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /Ajax/AjaxProcessorHttpHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | using System.Text; 6 | using System.Web; 7 | 8 | namespace Iridescent.Ajax 9 | { 10 | internal class AjaxProcessorHttpHandler:IHttpHandler 11 | { 12 | private Type _type; 13 | 14 | public AjaxProcessorHttpHandler(Type type) 15 | { 16 | _type = type; 17 | } 18 | 19 | public void ProcessRequest(HttpContext context) 20 | { 21 | context.Response.ContentType = "text/plain"; 22 | string method = context.Request.Headers["X-IridescentAjax-Method"]; 23 | MethodInfo methodInfo = _type.GetMethod(method); 24 | context.Response.Write(InvokeMethod(context,methodInfo).ToString()); 25 | } 26 | 27 | private object InvokeMethod(HttpContext context,MethodInfo methodInfo) 28 | { 29 | if(methodInfo!=null) 30 | { 31 | var parameters = methodInfo.GetParameters(); 32 | object[] methodParameters=new object[parameters.Length]; 33 | for (int i=0;i(); 24 | CacheIt("abc"); 25 | CacheIt(); 26 | CacheIt(); 27 | CacheIt(); 28 | CacheIt(); 29 | CacheIt(new StringBuilder("builder")); 30 | 31 | DataTable dt=new DataTable(); 32 | dt.Columns.Add("a"); 33 | for (int i = 0; i < 10000; i++) 34 | { 35 | DataRow row = dt.NewRow(); 36 | row["a"] = new string('中', 1000); 37 | dt.Rows.Add(row); 38 | } 39 | CacheIt(dt); 40 | 41 | CacheIt(new DataSet()); 42 | CacheIt(new List() { "abc" }); 43 | 44 | List tc=new List(); 45 | for (int i = 0; i < 10000; i++) 46 | { 47 | tc.Add(new TestClass()); 48 | } 49 | CacheIt(tc); 50 | 51 | CacheIt(new TestClass()); 52 | } 53 | 54 | private void CacheIt(T value = default(T)) 55 | { 56 | Console.WriteLine("------------------"); 57 | Stopwatch sw=new Stopwatch(); 58 | 59 | var redis = new HybridRedisCache(); 60 | string key = typeof(T).Name; 61 | 62 | sw.Start(); 63 | redis.Set(key, value, TimeSpan.FromSeconds(60)); 64 | sw.Stop(); 65 | Console.WriteLine("set:"+sw.Elapsed); 66 | 67 | sw.Reset(); 68 | sw.Start(); 69 | object cacheResult = redis.Get(key); 70 | sw.Stop(); 71 | Console.WriteLine("get:"+ sw.Elapsed); 72 | 73 | 74 | Console.WriteLine(cacheResult.GetType() + ", " + cacheResult); 75 | Assert.AreEqual(typeof(T), cacheResult.GetType()); 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /WebControls/WebControls.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 7 | 8 | 2.0 9 | {D310F788-1DA5-4626-AB08-37B833BD5988} 10 | Library 11 | Properties 12 | Iridescent.WebControls 13 | Iridescent.WebControls 14 | v4.0 15 | 512 16 | true 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 56 | -------------------------------------------------------------------------------- /UnitTest/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /Examples.IService/Examples.IService.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {D3C67F93-4977-471D-B8DE-022C1963C15F} 8 | Library 9 | Properties 10 | Examples.IService 11 | Examples.IService 12 | v4.0 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 53 | -------------------------------------------------------------------------------- /OrmUtils/SqlExpressCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Data; 4 | using System.Data.Common; 5 | using System.Text; 6 | using Iridescent.Data.QueryModel; 7 | using System.Linq; 8 | 9 | namespace Iridescent.OrmExpress 10 | { 11 | /// 12 | /// 精简的Sql命令对象 13 | /// 14 | public class SqlExpressCommand 15 | { 16 | public CommandType CommandType { get; set; } 17 | public StringBuilder Statement { get; set; } 18 | public IList DbParameters { get; set; } 19 | 20 | public string StatementString 21 | { 22 | get { return Statement != null ? Statement.ToString() : string.Empty; } 23 | } 24 | 25 | public void AppendStatement(string statement) 26 | { 27 | if (Statement == null) 28 | { 29 | Statement=new StringBuilder(20); 30 | } 31 | Statement.Append(statement); 32 | } 33 | 34 | public void AppendDbParameter(DbParameter dbParameter) 35 | { 36 | if (DbParameters == null) 37 | { 38 | DbParameters = new List(20); 39 | } 40 | DbParameters.Add(dbParameter); 41 | } 42 | 43 | public void TranslateQuery(Query query) 44 | { 45 | if (CommandType!=CommandType.Text) 46 | { 47 | throw new InvalidOperationException("只能为普通sql语句翻译查询"); 48 | } 49 | IQueryTranslator translator = QueryTranslatorFactory.Create(this, query); 50 | translator.Execute(); 51 | } 52 | 53 | public DbParameter[] GetDbParameterArray() 54 | { 55 | if(DbParameters==null) 56 | return new DbParameter[0]; 57 | return DbParameters.ToArray(); 58 | } 59 | 60 | public SqlExpressCommand(StringBuilder statement, IList sqlParameters):this(statement) 61 | { 62 | DbParameters = sqlParameters; 63 | } 64 | 65 | public SqlExpressCommand(StringBuilder statement):this() 66 | { 67 | Statement = statement; 68 | } 69 | 70 | public SqlExpressCommand() 71 | { 72 | CommandType = CommandType.Text; 73 | } 74 | 75 | public static SqlExpressCommand Create(string sqlStatement,Query query) 76 | { 77 | SqlExpressCommand command = new SqlExpressCommand(); 78 | command.AppendStatement(sqlStatement); 79 | command.TranslateQuery(query); 80 | return command; 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.sln.docstates 8 | 9 | # Build results 10 | 11 | [Dd]ebug/ 12 | [Rr]elease/ 13 | x64/ 14 | build/ 15 | [Bb]in/ 16 | [Oo]bj/ 17 | 18 | # MSTest test Results 19 | [Tt]est[Rr]esult*/ 20 | [Bb]uild[Ll]og.* 21 | 22 | *_i.c 23 | *_p.c 24 | *.ilk 25 | *.meta 26 | *.obj 27 | *.pch 28 | *.pdb 29 | *.pgc 30 | *.pgd 31 | *.rsp 32 | *.sbr 33 | *.tlb 34 | *.tli 35 | *.tlh 36 | *.tmp 37 | *.tmp_proj 38 | *.log 39 | *.vspscc 40 | *.vssscc 41 | .builds 42 | *.pidb 43 | *.log 44 | *.scc 45 | 46 | # Visual C++ cache files 47 | ipch/ 48 | *.aps 49 | *.ncb 50 | *.opensdf 51 | *.sdf 52 | *.cachefile 53 | 54 | # Visual Studio profiler 55 | *.psess 56 | *.vsp 57 | *.vspx 58 | 59 | # Guidance Automation Toolkit 60 | *.gpState 61 | 62 | # ReSharper is a .NET coding add-in 63 | _ReSharper*/ 64 | *.[Rr]e[Ss]harper 65 | 66 | # TeamCity is a build add-in 67 | _TeamCity* 68 | 69 | # DotCover is a Code Coverage Tool 70 | *.dotCover 71 | 72 | # NCrunch 73 | *.ncrunch* 74 | .*crunch*.local.xml 75 | 76 | # Installshield output folder 77 | [Ee]xpress/ 78 | 79 | # DocProject is a documentation generator add-in 80 | DocProject/buildhelp/ 81 | DocProject/Help/*.HxT 82 | DocProject/Help/*.HxC 83 | DocProject/Help/*.hhc 84 | DocProject/Help/*.hhk 85 | DocProject/Help/*.hhp 86 | DocProject/Help/Html2 87 | DocProject/Help/html 88 | 89 | # Click-Once directory 90 | publish/ 91 | 92 | # Publish Web Output 93 | *.Publish.xml 94 | *.pubxml 95 | 96 | # NuGet Packages Directory 97 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 98 | #packages/ 99 | 100 | # Windows Azure Build Output 101 | csx 102 | *.build.csdef 103 | 104 | # Windows Store app package directory 105 | AppPackages/ 106 | 107 | # Others 108 | sql/ 109 | ClientBin/ 110 | [Ss]tyle[Cc]op.* 111 | ~$* 112 | *~ 113 | *.dbmdl 114 | *.[Pp]ublish.xml 115 | *.pfx 116 | *.publishsettings 117 | 118 | # RIA/Silverlight projects 119 | Generated_Code/ 120 | 121 | # Backup & report files from converting an old project file to a newer 122 | # Visual Studio version. Backup files are not needed, because we have git ;-) 123 | _UpgradeReport_Files/ 124 | Backup*/ 125 | UpgradeLog*.XML 126 | UpgradeLog*.htm 127 | 128 | # SQL Server files 129 | App_Data/*.mdf 130 | App_Data/*.ldf 131 | 132 | # ========================= 133 | # Windows detritus 134 | # ========================= 135 | 136 | # Windows image file caches 137 | Thumbs.db 138 | ehthumbs.db 139 | 140 | # Folder config file 141 | Desktop.ini 142 | 143 | # Recycle Bin used on file shares 144 | $RECYCLE.BIN/ 145 | 146 | # Mac crap 147 | .DS_Store 148 | 149 | -------------------------------------------------------------------------------- /Iridescent.Cache/Iridescent.Cache.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {514D4CAF-5E16-41E0-B6A2-7BDDA5BA511C} 8 | Library 9 | Properties 10 | Iridescent.Cache 11 | Iridescent.Cache 12 | v4.0 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 58 | -------------------------------------------------------------------------------- /Etc/QueuePrototype/QueuePrototype/QueuePrototype.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {11335624-C82C-4E0F-9C04-EB14752DF33F} 9 | Exe 10 | Properties 11 | QueuePrototype 12 | QueuePrototype 13 | v4.0 14 | Client 15 | 512 16 | 17 | 18 | x86 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | x86 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 64 | -------------------------------------------------------------------------------- /Entities/Entities.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {B44F782D-806F-45F6-B85D-588DC55B7212} 9 | Library 10 | Properties 11 | Iridescent.Entities 12 | Iridescent.Entities 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | {10C0AA28-36C3-42F8-B068-53DB3904DD2E} 54 | OrmExpress 55 | 56 | 57 | 58 | 65 | -------------------------------------------------------------------------------- /Utils/Setting/ClassifySetting.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Web; 5 | using System.Web.Caching; 6 | using Iridescent.Utils.Common; 7 | 8 | namespace Iridescent.Utils.Setting 9 | { 10 | /// 11 | /// 分类配置 12 | /// 13 | public class ClassifySetting 14 | { 15 | private static readonly Dictionary _syncFileRoots = new Dictionary(); 16 | 17 | private static readonly object _syncRoot = new object(); 18 | 19 | internal const string SETTING_PATH = "__settings"; 20 | 21 | private static object GetLock(Type t) 22 | { 23 | lock (_syncRoot) 24 | { 25 | if (!_syncFileRoots.ContainsKey(t)) 26 | _syncFileRoots.Add(t, new object()); 27 | 28 | return _syncFileRoots[t]; 29 | } 30 | } 31 | 32 | public static T GetSetting() where T : class ,ISetting 33 | { 34 | string filePath = GetFilePath(typeof(T)); 35 | T setting = null; 36 | 37 | if (File.Exists(filePath)) 38 | { 39 | string cacheKey = "common_classify_setting_" + typeof(T).Name; 40 | setting = HttpRuntime.Cache.Get(cacheKey) as T; 41 | 42 | if (setting == null) 43 | { 44 | lock (GetLock(typeof(T))) 45 | { 46 | setting = XmlSerializerUtils.Deserialize(filePath); 47 | if (setting != null) 48 | { 49 | HttpRuntime.Cache.Insert(cacheKey, setting, new CacheDependency(filePath)); 50 | } 51 | } 52 | } 53 | } 54 | 55 | return setting; 56 | } 57 | 58 | public static void SaveSetting(ISetting setting) 59 | { 60 | if(setting==null) 61 | return; 62 | 63 | string filePath = GetFilePath(setting.GetType()); 64 | lock (GetLock(setting.GetType())) 65 | { 66 | string dir = GetFileDir(); 67 | if (!Directory.Exists(dir)) 68 | Directory.CreateDirectory(dir); 69 | 70 | XmlSerializerUtils.Serializer(filePath, setting); 71 | } 72 | } 73 | 74 | private static string GetFilePath(Type type) 75 | { 76 | return GetFileDir() + type.Name + ".config"; 77 | } 78 | 79 | private static string GetFileDir() 80 | { 81 | string dir = HttpContext.Current != null 82 | ? HttpContext.Current.Server.MapPath("~/" + SETTING_PATH + "/") 83 | : AppDomain.CurrentDomain.BaseDirectory + "/" + SETTING_PATH + "/"; 84 | return dir; 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /Data/Data.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {B390BEE5-D466-49C4-B920-C0B249B644C8} 9 | Library 10 | Properties 11 | Iridescent.Data 12 | Iridescent.Data 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 66 | -------------------------------------------------------------------------------- /Iridescent.DependencyResolution/Iridescent.DependencyResolution.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {C1E485B7-96D4-4493-BBFA-4ECC045570B5} 8 | Library 9 | Properties 10 | Iridescent.DependencyResolution 11 | Iridescent.DependencyResolution 12 | v4.0 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\packages\structuremap.2.6.4.1\lib\net40\StructureMap.dll 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 62 | -------------------------------------------------------------------------------- /Ajax/Ajax.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {F56EF3FC-ACD9-46EF-80FB-C66024E2ABE9} 9 | Library 10 | Properties 11 | Iridescent.Ajax 12 | Iridescent.Ajax 13 | v3.5 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 67 | -------------------------------------------------------------------------------- /Iridescent.Memcached/Iridescent.Memcached.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {1F6DBAC8-A556-4E05-AF5D-BF002F12CECC} 8 | Library 9 | Properties 10 | Iridescent.Memcached 11 | Iridescent.Memcached 12 | v4.0 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\packages\EnyimMemcached.2.12\lib\net35\Enyim.Caching.dll 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | {514d4caf-5e16-41e0-b6a2-7bdda5ba511c} 55 | Iridescent.Cache 56 | 57 | 58 | 59 | 66 | -------------------------------------------------------------------------------- /Utils/Verify/IDCardVerify.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace Iridescent.Utils.Verify 7 | { 8 | /// 9 | /// 参照 http://www.cnblogs.com/zhangchenliang/archive/2008/04/27/1173078.html 10 | /// 11 | public sealed class IDCardVerify 12 | { 13 | public static bool CheckIDCard(string Id) 14 | { 15 | if (Id.Length == 18) 16 | { 17 | bool check = CheckIDCard18(Id); 18 | return check; 19 | } 20 | if (Id.Length == 15) 21 | { 22 | bool check = CheckIDCard15(Id); 23 | return check; 24 | } 25 | 26 | return false; 27 | } 28 | 29 | public static bool CheckIDCard18(string Id) 30 | { 31 | long n = 0; 32 | if (long.TryParse(Id.Remove(17), out n) == false || n < Math.Pow(10, 16) || long.TryParse(Id.Replace('x', '0').Replace('X', '0'), out n) == false) 33 | { 34 | return false;//数字验证 35 | } 36 | string address = "11x22x35x44x53x12x23x36x45x54x13x31x37x46x61x14x32x41x50x62x15x33x42x51x63x21x34x43x52x64x65x71x81x82x91"; 37 | if (address.IndexOf(Id.Remove(2)) == -1) 38 | { 39 | return false;//省份验证 40 | } 41 | string birth = Id.Substring(6, 8).Insert(6, "-").Insert(4, "-"); 42 | DateTime time = new DateTime(); 43 | if (DateTime.TryParse(birth, out time) == false) 44 | { 45 | return false;//生日验证 46 | } 47 | string[] arrVarifyCode = ("1,0,x,9,8,7,6,5,4,3,2").Split(','); 48 | string[] Wi = ("7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2").Split(','); 49 | char[] Ai = Id.Remove(17).ToCharArray(); 50 | int sum = 0; 51 | for (int i = 0; i < 17; i++) 52 | { 53 | sum += int.Parse(Wi[i]) * int.Parse(Ai[i].ToString()); 54 | } 55 | int y = -1; 56 | Math.DivRem(sum, 11, out y); 57 | if (arrVarifyCode[y] != Id.Substring(17, 1).ToLower()) 58 | { 59 | return false;//校验码验证 60 | } 61 | return true;//符合GB11643-1999标准 62 | } 63 | 64 | public static bool CheckIDCard15(string Id) 65 | { 66 | long n = 0; 67 | if (long.TryParse(Id, out n) == false || n < Math.Pow(10, 14)) 68 | { 69 | return false;//数字验证 70 | } 71 | string address = "11x22x35x44x53x12x23x36x45x54x13x31x37x46x61x14x32x41x50x62x15x33x42x51x63x21x34x43x52x64x65x71x81x82x91"; 72 | if (address.IndexOf(Id.Remove(2)) == -1) 73 | { 74 | return false;//省份验证 75 | } 76 | string birth = Id.Substring(6, 6).Insert(4, "-").Insert(2, "-"); 77 | DateTime time = new DateTime(); 78 | if (DateTime.TryParse(birth, out time) == false) 79 | { 80 | return false;//生日验证 81 | } 82 | return true;//符合15位身份证标准 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Iridescent.Redis/RedisCache.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Runtime.Serialization.Formatters.Binary; 4 | using Iridescent.Cache; 5 | using ServiceStack.Redis; 6 | 7 | namespace Iridescent.Redis 8 | { 9 | /// 10 | /// Redis缓存类 11 | /// 12 | public class RedisCache:ICache 13 | { 14 | /// 15 | /// 将缓存值包装为强类型 16 | /// 17 | [Serializable] 18 | class ValueWrapper 19 | { 20 | public object Value { get; private set; } 21 | 22 | public ValueWrapper(object value) 23 | { 24 | Value = value; 25 | } 26 | } 27 | 28 | public bool Set(string key, object value) 29 | { 30 | IRedisClient client = RedisFactory.CreateClient(key); 31 | if (client == null) 32 | return false; 33 | 34 | using (client) 35 | { 36 | return client.Set(key, new ValueWrapper(value)); 37 | } 38 | } 39 | 40 | public bool Set(string key, object value, DateTime expiresAt) 41 | { 42 | IRedisClient client = RedisFactory.CreateClient(key); 43 | if (client == null) 44 | return false; 45 | 46 | using (client) 47 | { 48 | return client.Set(key, new ValueWrapper(value), expiresAt); 49 | } 50 | } 51 | 52 | public bool Set(string key, object value, TimeSpan expiresIn) 53 | { 54 | IRedisClient client = RedisFactory.CreateClient(key); 55 | if (client == null) 56 | return false; 57 | 58 | using (client) 59 | { 60 | return client.Set(key, new ValueWrapper(value), expiresIn); 61 | } 62 | } 63 | 64 | public object Get(string key) 65 | { 66 | return Get(key); 67 | } 68 | 69 | public T Get(string key) 70 | { 71 | IRedisClient client = RedisFactory.CreateClient(key); 72 | if (client == null) 73 | return default(T); 74 | 75 | T result = default(T); 76 | using (client) 77 | { 78 | ValueWrapper wrapper= client.Get(key); 79 | if (wrapper != null) 80 | { 81 | return (T) wrapper.Value; 82 | } 83 | } 84 | 85 | return result; 86 | } 87 | 88 | public bool Remove(string key) 89 | { 90 | IRedisClient client = RedisFactory.CreateClient(key); 91 | if (client == null) 92 | return false; 93 | 94 | using (client) 95 | { 96 | return client.Remove(key); 97 | } 98 | } 99 | 100 | public void FlushAll() 101 | { 102 | throw new NotSupportedException("缓存为分布式结构,暂不支持清空所有缓存"); 103 | } 104 | } 105 | } -------------------------------------------------------------------------------- /Utils/Common/EncryptUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Security.Cryptography; 3 | using System.Text; 4 | 5 | namespace Iridescent.Utils.Common 6 | { 7 | public static class EncryptUtils 8 | { 9 | public static string Md5(string str) 10 | { 11 | byte[] bytes = Encoding.Default.GetBytes(str); 12 | MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); 13 | byte[] hash = md5.ComputeHash(bytes); 14 | return BitConverter.ToString(hash).Replace("-", ""); 15 | } 16 | 17 | public static string GenerateSalt() 18 | { 19 | byte[] numArray = new byte[16]; 20 | new RNGCryptoServiceProvider().GetBytes(numArray); 21 | return Convert.ToBase64String(numArray); 22 | } 23 | 24 | /// 25 | /// 将密码进行sha1加密 26 | /// 27 | /// 28 | /// 29 | /// 30 | public static string EncodePassword(string pass, string salt) 31 | { 32 | byte[] bytes = Encoding.Unicode.GetBytes(pass); 33 | byte[] numArray1 = Convert.FromBase64String(salt); 34 | byte[] inArray; 35 | 36 | HashAlgorithm hashAlgorithm = HashAlgorithm.Create("SHA1"); 37 | if (hashAlgorithm is KeyedHashAlgorithm) 38 | { 39 | KeyedHashAlgorithm keyedHashAlgorithm = (KeyedHashAlgorithm)hashAlgorithm; 40 | if (keyedHashAlgorithm.Key.Length == numArray1.Length) 41 | keyedHashAlgorithm.Key = numArray1; 42 | else if (keyedHashAlgorithm.Key.Length < numArray1.Length) 43 | { 44 | byte[] numArray2 = new byte[keyedHashAlgorithm.Key.Length]; 45 | Buffer.BlockCopy((Array)numArray1, 0, (Array)numArray2, 0, numArray2.Length); 46 | keyedHashAlgorithm.Key = numArray2; 47 | } 48 | else 49 | { 50 | byte[] numArray2 = new byte[keyedHashAlgorithm.Key.Length]; 51 | int dstOffset = 0; 52 | while (dstOffset < numArray2.Length) 53 | { 54 | int count = Math.Min(numArray1.Length, numArray2.Length - dstOffset); 55 | Buffer.BlockCopy((Array)numArray1, 0, (Array)numArray2, dstOffset, count); 56 | dstOffset += count; 57 | } 58 | keyedHashAlgorithm.Key = numArray2; 59 | } 60 | inArray = keyedHashAlgorithm.ComputeHash(bytes); 61 | } 62 | else 63 | { 64 | byte[] buffer = new byte[numArray1.Length + bytes.Length]; 65 | Buffer.BlockCopy((Array)numArray1, 0, (Array)buffer, 0, numArray1.Length); 66 | Buffer.BlockCopy((Array)bytes, 0, (Array)buffer, numArray1.Length, bytes.Length); 67 | inArray = hashAlgorithm.ComputeHash(buffer); 68 | } 69 | 70 | return Convert.ToBase64String(inArray); 71 | } 72 | 73 | } 74 | } 75 | --------------------------------------------------------------------------------