Ejemplo n.º 1
0
        /// <summary>
        /// Setup Data Profile for assembly.
        /// </summary>
        /// <param name="dataAssemblyName">Data assembly</param>
        public static void SetupDataProfile(string dataAssemblyName)
        {
            Assembly.Load(dataAssemblyName);
            Assembly dataAssembly = LibraryHelper.GetAssembly(dataAssemblyName);

            Type[] types = dataAssembly.GetTypes();
            foreach (Type typeDataModel in types)
            {
                if (typeDataModel.IsSubclassOf(typeof(ZDataBase)) && !typeDataModel.IsAbstract)
                {
                    IZProfile profile = SetDataProfile(typeDataModel);

                    LibraryHelper.InvokeMethod(typeDataModel, "OnSetupProfile", new object[] { profile });
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Setup View Profile.
        /// </summary>
        /// <param name="dataAssemblyName">Data assembly</param>
        /// <param name="viewAssemblyName">View assembly</param>
        public static void SetupViewProfile(string dataAssemblyName, string viewAssemblyName)
        {
            Assembly.Load(dataAssemblyName);
            Assembly.Load(viewAssemblyName);
            Assembly dataAssembly = LibraryHelper.GetAssembly(dataAssemblyName);
            Assembly viewAssembly = LibraryHelper.GetAssembly(viewAssemblyName);

            Type[] types = dataAssembly.GetTypes();
            foreach (Type typeDataModel in types)
            {
                if (typeDataModel.IsSubclassOf(typeof(ZDataBase)) && !typeDataModel.IsAbstract)
                {
                    string viewModel     = typeDataModel.FullName + "ViewModel";
                    Type   typeViewModel = viewAssembly.GetType(viewModel);

                    IZProfile profile = SetViewProfile(typeViewModel, typeDataModel);

                    LibraryHelper.InvokeMethod(typeViewModel, "OnSetupProfile", new object[] { profile });
                }
            }
        }
Ejemplo n.º 3
0
        public ActivityViewAutoMapper()
        {
            Assembly dataAssembly = LibraryHelper.GetAssembly("EasyLOB.Activity.Data");
            Assembly viewAssembly = Assembly.GetExecutingAssembly();

            Type[] types = dataAssembly.GetTypes();
            foreach (Type type in types)
            {
                if (type.IsSubclassOf(typeof(ZDataBase)))
                {
                    string dto     = type.FullName + "DTO";
                    Type   typeDTO = dataAssembly.GetType(dto);

                    string viewModel     = type.FullName + "ViewModel";
                    Type   typeViewModel = viewAssembly.GetType(viewModel);

                    CreateMap(type, typeViewModel, MemberList.None);
                    CreateMap(typeDTO, typeViewModel, MemberList.None);
                    CreateMap(typeViewModel, typeDTO, MemberList.None);
                    CreateMap(typeViewModel, type, MemberList.None);
                }
            }
        }