Example #1
0
        /// <summary>
        /// Create aliases.
        /// </summary>
        /// <returns></returns>
        public List <string> CreateAliases()
        {
            List <string> jsInstructions_ = new List <string>();

            IEnumerable <Type> types_temp = this.Classes.SelectMany(dic => dic.Keys);

            //-- add alias in global variable 'NamespaceAliasDic'
            _JSNamespace.AddRangeAlias(types_temp);

            //-- alias of namespace
            //-- ex: var _alias0 = $dp.$JsNet.ContosoUniversity.Models;
            jsInstructions_.AddRange(_JSNamespace.ToJSInstructions(types_temp));

            return(jsInstructions_);
        }
Example #2
0
        private void InitiliazeForAspNetObjects(Assembly asp_net)
        {
            Type type_obj  = typeof(System.Object);
            Type type_type = typeof(System.Type);

            Type[] types;
            try
            {
                types = asp_net.GetExportedTypes();
            }
            catch (ReflectionTypeLoadException ex)
            {
                foreach (var excep in ex.LoaderExceptions)
                {
                    System.Console.WriteLine(excep.Message);
                }
                throw ex;
            }
            catch (Exception)
            {
                throw;
            }


            this.Types_Model = TypeHelper.GetCustomTypes(types
                                                         .Where(t => t.FullName.Contains(".Models") &&
                                                                (t.BaseType == type_obj || t.BaseType == null || (t.BaseType.FullName != null && t.BaseType.FullName.Contains("System.") == false))).ToArray(),
                                                         new string[] { }, new string[] { }).ToList();

            this.Types_Enum = TypeHelper.GetTypesOfEnum(types, new string[] { }, new string[] { });

            this.Types_Controller = types.Where(t => t.Name.Contains("Controller")).ToList();

            //this.Types_Model.Clear();//-- debug

            //-- Parameter and return types of action method.
            foreach (Type t in this.AllInOutClassTypes())
            {
                //if (t.FullName == "QuadraEden.Domain.EffetFacture" || t.FullName == "QuadraEden.Domain.Reglement")//-- debug
                {
                    if (this.Types_Model.Contains(t) == false)
                    {
                        //-- add Type which is not Collection.
                        this.Types_Model.Add(t);
                    }
                }
            }

            //-- Parameter and return types of action method.
            foreach (Type t in this.ParameterEnumTypes())
            {
                if (this.Types_Enum.Contains(t) == false)
                {
                    //-- add Type which is not Collection.
                    this.Types_Enum.Add(t);
                }
            }


            {
                _JSNamespace.ClearAlias();

                _JSNamespace.AddRangeAlias(this.Types_Model);
                _JSNamespace.AddRangeAlias(this.Types_Enum);
                _JSNamespace.AddRangeAlias(this.Types_Controller);
            }
        }