Ejemplo n.º 1
0
        public mphODInfo getObj()
        {
            var       context = getContext();
            mphODInfo dataObj = new mphODInfo();

            try
            {
                //var data = (from c in context.noms.Include(acc=>acc.accents_class).Include(part=>part.parts).Include(indent => indent.indents).Include(minoracc => minoracc.minor_acc).Include(flex=>flex.indents.flexes) where c.isactive == true && c.isdel == false orderby c.digit, c.field2, c.reestr select c);
                var data = (from c in context.words_list.AsNoTracking() where c.isdel == false orderby c.digit, c.field2, c.reestr select c);
                dataObj.words_list    = data./*Take(5).*/ ToArray();
                dataObj.types         = (from c in context.indents.AsNoTracking() orderby c.type select c).ToArray();                            // context.Local(context.indents).OrderBy(x => x.type).ToArray();
                dataObj.grs           = (from c in context.grs.AsNoTracking() orderby c.id select c).ToArray();                                  // context.Local(context.grs).OrderBy(x => x.id).ToArray();
                dataObj.accents       = (from c in context.accent.AsNoTracking() orderby c.accent_type, c.gram select c)./*Take(5).*/ ToArray(); // context.Local(context.accent).OrderBy(x => x.accent_type).ThenBy(y=>y.gram).ToArray();
                dataObj.parts         = (from c in context.parts.AsNoTracking() orderby c.id select c).ToArray();                                // context.Local(context.parts).OrderBy(x => x.id).ToArray();
                dataObj.accents_class = (from c in context.accents_class.AsNoTracking() orderby c.id select c).ToArray();                        // context.Local(context.accents_class).OrderBy(x => x.id).ToArray();
                dataObj.minor_accs    = (from c in context.minor_acc.AsNoTracking() orderby c.nom_old select c)./*Take(5).*/ ToArray();          // context.Local(context.minor_acc).OrderBy(x => x.nom_old).ToArray();
                //dataObj.allangs = (from c in context.allangs.AsNoTracking() where c.id_lang == 1058 orderby c.full_lang select c).ToArray(); // context.allangs.OrderBy(x => x.full_lang).ToArray();
                dataObj.lang        = (from c in context.lang.AsNoTracking() select c).ToArray();                                                // context.allangs.OrderBy(x => x.full_lang).ToArray();
                dataObj.alphadigits = (from c in context.alphadigits.AsNoTracking() orderby c.lang, c.digit, c.ls select c).ToArray();           // context.Local(context.alphadigits).OrderBy(x => x.lang).ThenBy(y=>y.digit).ThenBy(z => z.ls).ToArray();
                return(dataObj);
            }
            catch (Exception ex)
            {
                Logger.LogError(new EventId(0), ex, ex.Message);
                return(null);
            }
            finally
            {
                if ((db == null) && (context != null))
                {
                    context.Dispose();
                }
            }
        }
Ejemplo n.º 2
0
        public void copyFromObj(mphODInfo o)
        {
            var context = getContext();

            try
            {
                this.removeData();

                context.alphadigits.AddRange(o.alphadigits);
                context.SaveChanges();

                context.lang.AddRange(o.lang);
                context.SaveChanges();

                //for(int i=0;i< o.accents_class.Length;i++)
                //{
                //    context.accents_class.Add(o.accents_class[i]);
                //}
                //context.SaveChanges();
                //context.accents_class.AddRange(o.accents_class);
                //context.SaveChanges();

                //context.accent.AddRange(o.accents);
                //context.SaveChanges();

                //context.grs.AddRange(o.grs.Select(c=>new Models.morph.gr() { id=c.id, part_of_speech = c.part_of_speech }));
                //context.SaveChanges();

                //context.parts.AddRange(o.parts);
                //context.SaveChanges();

                //context.indents.AddRange(o.indents);
                //context.SaveChanges();

                //context.flexes.AddRange(o.flexes);
                //context.SaveChanges();

                //context.words_list.AddRange(o.words_list);
                //context.SaveChanges();

                //context.minor_acc.AddRange(o.minor_accs);
                //context.SaveChanges();
            }
            catch (Exception ex)
            {
                Logger.LogError(new EventId(0), ex, ex.Message);
            }
            finally
            {
                if ((db == null) && (context != null))
                {
                    context.Dispose();
                }
            }
        }