public CatalogLoader(CatalogDB db, IEnumerable <Type> possibleTypes) { this.db = db; foreach (Type t in possibleTypes) { string name = t.Name; object[] attrs = t.GetCustomAttributes(typeof(CatalogEntryInfo), false); if (attrs.Length > 0) { name = ((CatalogEntryInfo)attrs[0]).name; } EntryInfo info = new EntryInfo(t); List <EntryFieldInfo> efi = new List <EntryFieldInfo>(); //Debug.Log( name ); foreach (FieldInfo fld in t.GetFields()) { foreach (CatalogLoaded attr in fld.GetCustomAttributes(typeof(CatalogLoaded), false).Cast <CatalogLoaded>()) { efi.Add(new EntryFieldInfo(fld, attr.name != null?attr.name:fld.Name)); //Debug.Log( "\t"+attr.name!=null?attr.name:fld.Name ); } } info.fields = efi.ToArray(); loadTags.Add(name, info); tagNames.Add(t, name); } }
async public void SaveToParse () { ParseObject catalog; if (this.ParseId == null || this.ParseId == "") { catalog = new ParseObject ("Catalogo"); } else { ParseQuery<ParseObject> query = ParseObject.GetQuery ("Catalogo"); catalog = await query.GetAsync (this.ParseId); } IList<string> movies = new List<string> (); MoviexCatalogDB moviexCatalogDB = new MoviexCatalogDB (); foreach (MoviexCatalog moviexCatalog in moviexCatalogDB.All ().Where (mxc => mxc.IdCatalog.Equals (this.Id))) { moviexCatalog.SaveToParse (); movies.Add (moviexCatalog.ParseId); } if (this.User != null) { catalog ["Usuario"] = this.User.ParseId; } catalog ["Peliculas"] = movies; await catalog.SaveAsync ().ContinueWith (t => { this.ParseId = catalog.ObjectId; Console.WriteLine("Saved Catalog in Parse: " + this.ParseId); CatalogDB catalogDB = new CatalogDB (); catalogDB.Update (this); }); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); var container = UnityConfig.GetConfiguredContainer(); UnityConfig.RegisterTypes(container); CatalogDB.Initialize(); }