斗爷

导航

项目中用到的架构模式(持续更新)

1. asp.net mvc 

view + controller + model

2. 利用StructureMap Ioc

   public class BootStrapper
    {
        public static void ConfigureStructureMap()
        {
            // Initialize the registry
            ObjectFactory.Initialize(x =>
            {
                x.AddRegistry<ModelRegistry>();

            });
        }

        public class ModelRegistry : Registry
        {
            public ModelRegistry()
            {
                //ClientControl
                ForRequestedType<IGetMainAllData>().TheDefault.Is.OfConcreteType<GetMainAllDataByTime>(); 
                ForRequestedType<IGetHomeAllData>().TheDefault.Is.OfConcreteType<GetHomeAllDataByTime>();              
                ForRequestedType<IGetEnvironmentAllData>().TheDefault.Is.OfConcreteType<GetEnvironmentAllDataByTime>();
                ForRequestedType<IGetBuildAllData>().TheDefault.Is.OfConcreteType<GetBuildAllDataByTime>();
                ForRequestedType<IGetEnergyAllData>().TheDefault.Is.OfConcreteType<GetEnergyAllDataByTime>();
                ForRequestedType<IGetGridAllData>().TheDefault.Is.OfConcreteType<GetGridAllDataByTime>();
                ForRequestedType<IGetQueryAllData>().TheDefault.Is.OfConcreteType<GetQueryAllDataByTime>();
                ForRequestedType<IGetWarnAllData>().TheDefault.Is.OfConcreteType<GetWarnAllDataByTime>();
                ForRequestedType<IGetSplitAllData>().TheDefault.Is.OfConcreteType<GetSplitAllDataByTime>();

                //DataAccess
                ForRequestedType<IMainData>().TheDefault.Is.OfConcreteType<MainDataControl>();
                ForRequestedType<IHomePageData>().TheDefault.Is.OfConcreteType<HomePageDataControl>();
                ForRequestedType<IEnvironmentParametersData>().TheDefault.Is.OfConcreteType<EnvironmentParametersDataControl>();
                ForRequestedType<IBuildingData>().TheDefault.Is.OfConcreteType<BuildingDataControl>();
                ForRequestedType<IEnergyData>().TheDefault.Is.OfConcreteType<EnergyDataControl>();
                ForRequestedType<IGridData>().TheDefault.Is.OfConcreteType<GridDataControl>();
                ForRequestedType<IQueryData>().TheDefault.Is.OfConcreteType<QueryDataControl>();
                ForRequestedType<IWarnData>().TheDefault.Is.OfConcreteType<WarnDataControl>();

                //Cache
                ForRequestedType<ICacheStorage>().TheDefault.Is.OfConcreteType<HttpContextCache>();
            }
        }
    }

3. asp.net + extjs3.4 + fusioncharts

4. (winform)mvp + service + model + repository

5. spring 3.1 mvc  + service + persistense + mybatis 3

6. Request + Response 模式

7.Null Object 模式

   public class NullObjectCachingAdapter : ICacheStorage 
    {        
        public void Remove(string key)
        {
            // Do nothing
        }

        public void Store(string key, object data)
        {
            // Do nothing
        }

        public T Retrieve<T>(string storageKey)
        {
            return default(T);
        }        
    }

 

posted on 2013-05-02 16:14  斗哥哥  阅读(707)  评论(0编辑  收藏  举报