Esempio n. 1
0
        private string GetClassList()
        {
            ClassService = new ClassService();
            List <object> ClassObj = BaseService.GetObjectList(ClassService, Request);

            ClassCoount = ClassService.ObjectCount();
            if (ClassObj != null)
            {
                List <@class> Classes            = (List <@class>)ObjectUtil.ConvertList(ClassObj, typeof(List <@class>));
                List <@class> ClassesToSerialize = new List <@class>();
                if (Classes.Count > 0)
                {
                    foreach (@class CLass in Classes)
                    {
                        @class NewClass = (@class)ObjectUtil.GetObjectValues(new string[] {
                            "id", "class_name"
                        }, CLass);
                        ClassesToSerialize.Add(NewClass);
                    }

                    return(JsonConvert.SerializeObject(ClassesToSerialize));
                }
                return("0");
            }
            return("0");
        }
Esempio n. 2
0
        private void ProcessEntityTablePerSubClass(Entity entity, @class classNode)
        {
            foreach (var childEntity in entity.Children)
            {
                var mappedTable = childEntity.MappedTables().First();

                var subclassNode = new joinedsubclass();
                subclassNode.table  = mappedTable.Name.BackTick();
                subclassNode.schema = mappedTable.Schema.BackTick();
                subclassNode.name   = childEntity.Name;

                key keyNode = GetKeyNode(mappedTable);
                subclassNode.key = keyNode;

                foreach (var property in childEntity.ConcreteProperties)
                {
                    IColumn column = property.MappedColumn();
                    if (column == null)
                    {
                        continue;
                    }

                    property propNode = ProcessProperty(property, column);
                    subclassNode.AddProperty(propNode);
                }
                classNode.AddItem1(subclassNode);

                var referenceMapper = new ReferenceMapper();
                referenceMapper.ProcessReferences(childEntity, item => subclassNode.AddItem(item));

                ProcessInheritance(childEntity, subclassNode);
            }
        }
Esempio n. 3
0
        private string AddClass()
        {
            @class Class = (@class)ObjectUtil.FillObjectWithMap(new @class(), BaseService.ReqToDict(Request));

            if (Class != null)
            {
                ClassService = new ClassService();
                @class classDB = null;
                if (Class.id != null && Class.id != "")
                {
                    classDB = (@class)ClassService.Update(Class);
                }
                else
                {
                    classDB = (@class)ClassService.Add(Class);
                }
                if (classDB == null)
                {
                    return("0");
                }
                @class toSend = (@class)ObjectUtil.GetObjectValues(new string[] {
                    "id", "class_name"
                }, classDB);
                return(JsonConvert.SerializeObject(toSend));
            }
            return("0");
        }
Esempio n. 4
0
        private void ackbtn_Click(object sender, EventArgs e)
        {
            //添加班级,更新各种信息到数据库
            #region

            var query = from teachername in db.teacher
                        where teachername.Teacher_name == techernamebox.Text
                        select teachername.Teacher_id;
            try { query.First(); }
            catch { MessageBox.Show("没有该老师!"); return; }
            @class a = new @class();
            a.Class_id        = gradebox.Text + classbox.Text;
            a.Class_name      = classnamebox.Text;
            a.Class_college   = classcollege.Text;
            a.Class_teacherid = query.First();
            [email protected](a);
            try
            {
                db.SubmitChanges();
                MessageBox.Show("添加成功!");
            }
            catch { MessageBox.Show("添加失败!"); }
            #endregion
            //
            #region
            var again = (from temp in db.@class
                         select new { 班级编号 = temp.Class_id, 班级名称 = temp.Class_name, 所属学院 = temp.Class_college, 辅导员编号 = temp.Class_teacherid }).ToList();
            dataGridView1.DataSource = again;
            #endregion
        }
Esempio n. 5
0
 private void AddProperties(@class clazz,string entity, ITableMetadata tableMetaData)
 {
     var columnSet = currentContext.Schema.GetColumns(tableMetaData.Catalog, tableMetaData.Schema, tableMetaData.Name, null);
     int nameOrdinal = columnSet.Columns.IndexOf(COLUMN_NAME);
     int typeOrdinal = columnSet.Columns.IndexOf(DATA_TYPE);
     foreach (DataRow row in columnSet.Rows)
     {
         var cInfo = tableMetaData.GetColumnMetadata(row.ItemArray[nameOrdinal].ToString());
         property p = currentContext.Model.AddPropertyToEntity(entity
                                                             ,currentContext.NamingStrategy.GetPropertyNameFromColumnName(cInfo.Name));
         p.notnull = !true.ParseFromDb(cInfo.Nullable);
         p.notnullSpecified = !true.ParseFromDb(cInfo.Nullable);
         p.column = 0 == string.Compare(p.name,cInfo.Name,true)?null:cInfo.Name;
         p.type1 = typeConverter.GetNHType(cInfo);
         if (p.type1 == null)
         {
             logger.Warn(string.Format("No NHibernate type defined for dbtype:{0} len:{1}", cInfo.TypeName, cInfo.ColumnSize));
         }
         if (cInfo.ColumnSize > 0)
         {
             p.length = cInfo.ColumnSize.ToString();
         }
         if (cInfo.NumericalPrecision > 0)
         {
             p.precision = cInfo.NumericalPrecision.ToString();
         }
     }
 }
 public void Apply(@class entity,IMappingModel model)
 {
     if (entityMatch.IsProperMatch(entity.name))
     {
         bindAction(entity.name, model);
     }
 }
        public override Dictionary <string, object> ObjectList(int Offset, int Limit, List <Dictionary <string, object> > ObjectList)
        {
            int           TotalCount = 0;
            List <@class> @classs    = new List <@class>();
            List <Dictionary <string, object> > @classListMap = ObjectList;

            if (@classListMap.Count == 0)
            {
                goto end;
            }

            foreach (Dictionary <string, object> @classMap in @classListMap)
            {
                if (@classMap.Keys.Count == 1 && @classMap.Keys.ElementAt(0).Equals("count"))
                {
                    TotalCount = (int)@classMap["count"];
                    break;
                }

                @class @class = (@class)ObjectUtil.FillObjectWithMap(new @class(), @classMap);
                @classs.Add(@class);
            }

end:
            return(new Dictionary <string, object>()
            {
                { "totalCount", TotalCount },
                { "data", @classs }
            });
        }
Esempio n. 8
0
        private List <object> ListWithSql(string sql, int limit = 0, int offset = 0)
        {
            List <object> classList = new List <object>();
            var           classes   = dbEntities.classes
                                      .SqlQuery(sql
                                                ).
                                      Select(c => new
            {
                c
            });

            if (limit > 0)
            {
                classes = classes.Skip(offset * limit).Take(limit).ToList();
            }
            else
            {
                classes = classes.ToList();
            }
            foreach (var c in classes)
            {
                @class Class = c.c;
                classList.Add(Class);
            }

            return(classList);
        }
Esempio n. 9
0
        private void AddProperties(@class clazz, string entity, ITableMetadata tableMetaData)
        {
            var columnSet   = currentContext.Schema.GetColumns(tableMetaData.Catalog, tableMetaData.Schema, tableMetaData.Name, null);
            int nameOrdinal = columnSet.Columns.IndexOf(COLUMN_NAME);
            int typeOrdinal = columnSet.Columns.IndexOf(DATA_TYPE);

            foreach (DataRow row in columnSet.Rows)
            {
                var      cInfo = tableMetaData.GetColumnMetadata(row.ItemArray[nameOrdinal].ToString());
                property p     = currentContext.Model.AddPropertyToEntity(entity
                                                                          , currentContext.NamingStrategy.GetPropertyNameFromColumnName(cInfo.Name));
                p.notnull          = !true.ParseFromDb(cInfo.Nullable);
                p.notnullSpecified = !true.ParseFromDb(cInfo.Nullable);
                p.column           = 0 == string.Compare(p.name, cInfo.Name, true)?null:cInfo.Name;
                p.type1            = typeConverter.GetNHType(cInfo);
                if (p.type1 == null)
                {
                    logger.Warn(string.Format("No NHibernate type defined for dbtype:{0} len:{1}", cInfo.TypeName, cInfo.ColumnSize));
                }
                if (cInfo.ColumnSize > 0)
                {
                    p.length = cInfo.ColumnSize.ToString();
                }
                if (cInfo.NumericalPrecision > 0)
                {
                    p.precision = cInfo.NumericalPrecision.ToString();
                }
            }
        }
Esempio n. 10
0
        public override void Delete(object Obj)
        {
            @class Class = (@class)Obj;

            dbEntities.classes.Remove(Class);
            dbEntities.SaveChanges();
        }
Esempio n. 11
0
        /// <summary>
        ///   Gets the properties for the given class.
        /// </summary>
        public IEnumerable <property> GetPropertiesFor(@class cls)
        {
            List <property> items = new List <property>();

            // Add class items if any
            if (cls.property != null)
            {
                items.AddRange(cls.property);
            }

            // Add extension items if any
            IEnumerable <property> extensionItems = this.GetClassExtensionFor(cls).Where(c => c.property != null).SelectMany(c => c.property);

            if (extensionItems != null)
            {
                items.AddRange(extensionItems);
            }

            foreach (property item in items)
            {
                if ("class;description;version".Contains(item.name))
                {
                    continue;
                }
                if (item.hidden)
                {
                    continue;
                }
                yield return(item);
            }
        }
Esempio n. 12
0
        /// <summary>
        ///   Gets the elements for the given class.
        /// </summary>
        public IEnumerable <element> GetElementsFor(@class cls)
        {
            List <element> items = new List <element>();

            // Add class items if any
            if (cls.element != null)
            {
                items.AddRange(cls.element);
            }

            // Add extension items if any
            IEnumerable <element> extensionItems = this.GetClassExtensionFor(cls).Where(c => c.element != null).SelectMany(c => c.element);

            if (extensionItems != null)
            {
                items.AddRange(extensionItems);
            }

            // Retrieve the base class if any
            @class baseClass = null;
            String type      = cls.inherits;

            if (type != null)
            {
                baseClass = (from c in this.Classes
                             where (c.id != null && String.Equals(c.id, type)) ||
                             (c.id == null && String.Equals(c.name, type))
                             select c).FirstOrDefault();
            }

            // Filter out elements to avoid override
            if (baseClass != null && baseClass.element != null)
            {
                IEnumerable <element> baseElements = this.GetElementsFor(baseClass);
                foreach (element item in items)
                {
                    if (item.hidden)
                    {
                        continue;
                    }
                    element baseItem = baseElements.FirstOrDefault(e => String.Equals(e.type, item.type));
                    if (baseItem != null)
                    {
                        continue;
                    }
                    yield return(item);
                }
            }
            else
            {
                foreach (element item in items)
                {
                    if (item.hidden)
                    {
                        continue;
                    }
                    yield return(item);
                }
            }
        }
Esempio n. 13
0
 public void Apply(@class entity, IMappingModel model)
 {
     if (entityMatch.IsProperMatch(entity.name))
     {
         bindAction(entity.name, model);
     }
 }
Esempio n. 14
0
        private void ProcessInheritance(Entity entity, @class newClass)
        {
            EntityImpl.InheritanceType inheritanceType = EntityImpl.DetermineInheritanceTypeWithChildren(entity);

            switch (inheritanceType)
            {
            case EntityImpl.InheritanceType.None:
            case EntityImpl.InheritanceType.TablePerConcreteClass:
                // Table per concrete class doesn't need special treatment.
                break;

            case EntityImpl.InheritanceType.TablePerClassHierarchy:
                // All child entities are mapped to the same table as the parent.
                ProcessEntityTablePerClassHierarchy(entity, newClass);
                break;

            case EntityImpl.InheritanceType.TablePerSubClass:
                ProcessEntityTablePerSubClass(entity, newClass);
                break;

            case EntityImpl.InheritanceType.Unsupported:
                throw new Exception("An unsupported inheritance structure was detected. "
                                    + "We only support Table Per Class Hierarchy, Table Per Sub Class, and Table Per Concrete Class. "
                                    + "See the NHibernate documentation for more details.");

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Esempio n. 15
0
        public @class GetClassFromTableName(string tableName)
        {
            @class ret = null;

            this.entityMapByTable.TryGetValue(tableName, out ret);
            return(ret);
        }
Esempio n. 16
0
        public @class GetClassFromEntityName(string entityName)
        {
            @class ret = null;

            entityMapByEntity.TryGetValue(entityName, out ret);
            return(ret);
        }
Esempio n. 17
0
        private string GetStudentList()
        {
            studentService = new StudentService();
            List <object> StudentObj = BaseService.GetObjectList(studentService, Request);

            StudentCount = studentService.ObjectCount();
            if (StudentObj != null)
            {
                List <student> Students            = (List <student>)ObjectUtil.ConvertList(StudentObj, typeof(List <student>));
                List <student> StudentsToSerialize = new List <student>();
                if (Students.Count > 0)
                {
                    foreach (student Std in Students)
                    {
                        @class StdClass = new @class()
                        {
                            id         = Std.class_id,
                            class_name = [email protected]_name
                        };

                        student StdNew = (student)ObjectUtil.GetObjectValues(new string[] {
                            "id", "name", "bod", "class_id", "address", "email"
                        }, Std);
                        StdNew.@class = StdClass;
                        StudentsToSerialize.Add(StdNew);
                    }

                    return(JsonConvert.SerializeObject(StudentsToSerialize));
                }
                return("0");
            }
            return("0");
        }
        public ClassViewModel(int _id)
        {
            LoadGrades();
            _className = DataProvider.Ins.DB.classes.Where(x => x.id == _id).ToArray()[0].name;
            int IdGrade = DataProvider.Ins.DB.classes.Where(x => x.id == _id).ToArray()[0].id_grade;

            GradeName   = DataProvider.Ins.DB.grades.Where(x => x.id == IdGrade).ToArray()[0].name;
            SaveCommand = new RelayCommand <Window>((p) => { return(true); },
                                                    async(p) =>
            {
                EditClass w    = p as EditClass;
                var mySettings = new MetroDialogSettings()
                {
                    AffirmativeButtonText = "Ok",
                    ColorScheme           = w.MetroDialogOptions.ColorScheme
                };
                @class EditingClass   = DataProvider.Ins.DB.classes.Where(x => x.id == w.Id).ToArray()[0];
                EditingClass.name     = _className;
                EditingClass.id_grade = DataProvider.Ins.DB.grades.Where(x => x.name == _gradeName).ToArray()[0].id;
                if (DataProvider.Ins.DB.classes.Where(x => x.name == EditingClass.name && x.id_grade == EditingClass.id_grade).FirstOrDefault() != null)
                {
                    await w.ShowMessageAsync("Hello!", "The class is exist.", MessageDialogStyle.Affirmative, mySettings);
                    return;
                }
                DataProvider.Ins.DB.SaveChanges();
                await w.ShowMessageAsync("Hello!", "Saved success.", MessageDialogStyle.Affirmative, mySettings);
                LoadData();
                EnrollViewModel.LoadClasses();
                w.Close();
            });
        }
Esempio n. 19
0
        private bool IsManyToManyJoin(@class e)
        {
            // no properties and two many to ones is a many to many
            var props   = context.Model.GetPropertyOfEntity(e.name);
            var mtoones = context.Model.GetManyToOnesOfEntity(e.name);

            return(props.Length == 0 && mtoones.Length == 2);
        }
Esempio n. 20
0
 private manytoone CreateManyToOne(IForeignKeyColumnInfo iForeignKeyColumnInfo,@class referredClass)
 {
     manytoone mto = new manytoone();
     mto.column = iForeignKeyColumnInfo.ForeignKeyColumnName;
     mto.@class = referredClass.name;
     mto.name = currentContext.NamingStrategy.GetNameForManyToOne(referredClass.name, new string[] { iForeignKeyColumnInfo.ForeignKeyColumnName });
     return SetIfNullable(mto,new IForeignKeyColumnInfo[]{iForeignKeyColumnInfo});
 }
        public override Panel ShowAddForm(object Object = null)
        {
            @class EditClass = (@class)Object;
            bool   EditState = EditClass != null;

            ClearAllFields();
            //  UpdateList();
            Button BtnAdd = new Button()
            {
                Text = "Add"
            };

            BtnAdd.Click += (e, o) =>
            {
                @class Class = new @class()
                {
                    id         = EditState ? InputID.Text : null,
                    class_name = InputClassName.Text.Trim(),
                    students   = null
                };
                if (null != UserClient.AddClass(Class, AppUser))
                {
                    MessageBox.Show("Success");
                    EntityForm.Navigate(0, 0);
                }
                else
                {
                    MessageBox.Show("Failed");
                }
            };
            InputID.Enabled = false;
            InputID.Text    = "GENERATED";

            if (EditState)
            {
                InputID.Text        = EditClass.id;
                InputClassName.Text = EditClass.class_name.Trim();
            }

            Control[] Controls = new Control[]
            {
                new TitleLabel(20)
                {
                    Text = "Add Class"
                }, new BlankControl(),
                new Label()
                {
                    Text = "ID"
                }, InputID,
                new Label()
                {
                    Text = "Name"
                }, InputClassName,
                BtnAdd, null
            };

            return(ControlUtil.GeneratePanel(2, Controls, 5, 180, 30, Color.Aqua));
        }
 public @class AddClassForTable(string tableName, string entityName)
 {
     @class clazz = new @class();
     clazz.name = entityName;
     clazz.table = tableName;
     entityMapByTable[tableName] = clazz;
     entityMapByEntity[entityName] = clazz;
     return clazz;
 }
Esempio n. 23
0
 public static ClassDTO ClassToDTO(@class c)
 {
     return(new ClassDTO()
     {
         class_id = c.class_id,
         class_name = c.class_name,
         teacher_id = c.teacher_id
     });
 }
Esempio n. 24
0
 private manytoone CreateManyToOne(IForeignKeyColumnInfo[] keyManyToOne, @class referredClass)
 {
     manytoone mto = new manytoone();
     mto.Items = keyManyToOne.Select(q => new column(){ name=q.ForeignKeyColumnName}).ToArray();
     mto.@class = referredClass.name;
     mto.name = currentContext.NamingStrategy.GetNameForManyToOne(referredClass.name
                                 , keyManyToOne.Select(q=>q.ForeignKeyColumnName).ToArray() );
     return SetIfNullable(mto,keyManyToOne);
 }
Esempio n. 25
0
 public void Apply(Type type, @class @class, IEnumerable <Type> entityTypes, hibernatemapping hbm)
 {
     if (type.GetMember("Version").Any())
     {
         @class.version = new version {
             name = "Version", column1 = "Version"
         }
     }
     ;
 }
Esempio n. 26
0
 public Class(@class cls)
 {
     if (cls != null)
     {
         this.Id       = cls.Id;
         this.Name     = cls.Name;
         this.IsActive = cls.IsActive;
         this.Sections = cls.classsections.Select(i => new Section(i.section)).ToList();
     }
 }
Esempio n. 27
0
        public @class AddClassForTable(string tableName, string entityName)
        {
            @class clazz = new @class();

            clazz.name  = entityName;
            clazz.table = tableName;
            entityMapByTable[tableName]   = clazz;
            entityMapByEntity[entityName] = clazz;
            return(clazz);
        }
Esempio n. 28
0
        private bool IsOf(@class e, object toremove)
        {
            PropertyInfo pi = toremove.GetType().GetProperty("Item");

            if (null != pi)
            {
                onetomany theclass = pi.GetValue(toremove, null) as onetomany;
                return(theclass != null && 0 == string.Compare(theclass.@class, e.name));
            }
            return(false);
        }
Esempio n. 29
0
 public void Apply(Type type, @class @class, IEnumerable <Type> entityTypes, hibernatemapping hbm)
 {
     foreach (var memberInfo in type.GetSettableFieldsAndProperties())
     {
         var component = GetComponent(memberInfo);
         if (component != null)
         {
             @class.component.Add(component);
         }
     }
 }
Esempio n. 30
0
        public @class GetDataObject()
        {
            var dataObject = new @class()
            {
                Id       = this.Id,
                Name     = this.Name,
                IsActive = this.IsActive
            };

            return(dataObject);
        }
        public static void AddClass(this hibernatemapping hm, @class @class)
        {
            if (hm.Items == null)
            {
                hm.Items = new object[0];
            }

            object[] items = hm.Items;
            Array.Resize(ref items, hm.Items.Length + 1);
            items[items.Length - 1] = @class;
            hm.Items = items;
        }
Esempio n. 32
0
 private void ProcessEntityKey(Entity entity, @class newClass, ITable table)
 {
     // We do nothing with EntityKeyType.Empty, as there is nothing to do.
     if (entity.Key.KeyType == EntityKeyType.Properties)
     {
         ProcessPropertyEntityKey(entity, newClass, table);
     }
     else if (entity.Key.KeyType == EntityKeyType.Component)
     {
         compositeid cId = GetCompositeIDWithComponent(entity.Key.Component);
         newClass.SetCompositeId(cId);
     }
 }
Esempio n. 33
0
        private manytoone CreateManyToOne(IForeignKeyColumnInfo[] keyManyToOne, @class referredClass)
        {
            manytoone mto = new manytoone();

            mto.Items = keyManyToOne.Select(q => new column()
            {
                name = q.ForeignKeyColumnName
            }).ToArray();
            mto.@class = referredClass.name;
            mto.name   = currentContext.NamingStrategy.GetNameForManyToOne(referredClass.name
                                                                           , keyManyToOne.Select(q => q.ForeignKeyColumnName).ToArray());
            return(SetIfNullable(mto, keyManyToOne));
        }
Esempio n. 34
0
        public override object Add(object Obj)
        {
            @class Class = (@class)Obj;

            if (Class.id == null)
            {
                Class.id = StringUtil.GenerateRandomChar(7);
            }
            @class newclass = dbEntities.classes.Add(Class);

            dbEntities.SaveChanges();
            return(newclass);
        }
Esempio n. 35
0
        public static SpringMvcController getRequestMapping(@class javaAttributeClass)
        {
            var requestMappingAnnotation = getAnnotation(javaAttributeClass, SPRING_MVC_CLASS_REQUEST_MAPPING);
            var mappedControler          = getRequestMapping(requestMappingAnnotation);

            if (mappedControler != null)
            {
                mappedControler.JavaClass  = javaAttributeClass.name;
                mappedControler.FileName   = javaAttributeClass.sourceFile;
                mappedControler.LineNumber = 0;
            }
            return(mappedControler);
        }
 private void CheckIfCanBeMap(set set, @class entity)
 {
     if (set.Item is onetomany)
     {
         var collectedEntity = context.Model.GetClassFromEntityName((set.Item as onetomany).@class);
         if (collectedEntity.Item is compositeid)
         {
             var cid = collectedEntity.Item as compositeid;
             List<string> setColumn = new List<string>();
             if (!string.IsNullOrEmpty(set.key.column1))
                 setColumn.Add(set.key.column1);
             if (null != set.key.column)
                 setColumn.AddRange(set.key.column.Select(q => q.name));
             List<string> collectedKeyColumns = new List<string>();
             collectedKeyColumns.AddRange(cid.Items.OfType<keyproperty>().Select(q => q.column1 ?? q.name));
             List<string> nonOverlappingColumns;
             if (CheckOverlapping(setColumn, collectedKeyColumns, out nonOverlappingColumns))
             {
                 setToRemove.Add(set);
                 entitiesToRemove.Add(collectedEntity.name);
                 map map = new map();
                 map.name = set.name;
                 map.table = set.table;
                 map.key = set.key;
                 var meta = context.GetTableMetaData(collectedEntity.schema, collectedEntity.table ?? collectedEntity.name);
                 if (nonOverlappingColumns.Count == 1)
                 {
                     map.Item = new index() { column1 = nonOverlappingColumns[0], type = typeConverter.GetNHType(meta.GetColumnMetadata(nonOverlappingColumns[0])) };
                 }
                 else
                 {
                     compositeindex ci = new compositeindex();
                     ci.@class = context.NamingStrategy.GetClassNameForComponentKey(map.name??map.table);
                     ci.Items = nonOverlappingColumns.Select(q => new keyproperty() {
                             name = context.NamingStrategy.GetPropertyNameFromColumnName(q)
                            ,column1 = context.NamingStrategy.GetPropertyNameFromColumnName(q) != q ? q : null
                            ,type1=typeConverter.GetNHType(meta.GetColumnMetadata(q))
                            ,length = meta.GetColumnMetadata(q).ColumnSize == 0 ? null:meta.GetColumnMetadata(q).ColumnSize.ToString()
                     }).ToArray();
                     map.Item = ci;
                 }
                 property[] props = collectedEntity.Items.OfType<property>().ToArray();
                 if (props.Length == 1)
                 {
                     //use an element
                     element e = new element();
                     e.column = props[0].column ?? props[0].name;
                     e.type1 = props[0].type1;
                     e.type = props[0].type;
                     e.precision = props[0].precision;
                     e.length = props[0].length;
                     map.Item1 = e;
                 }
                 else
                 {
                     //use a composite element
                     compositeelement ce = new compositeelement();
                     ce.@class = context.NamingStrategy.GetClassNameForCollectionComponent(collectedEntity.table??collectedEntity.name);
                     ce.Items = context.Model.GetPropertyOfEntity(collectedEntity.name);
                     map.Item1 = ce;
                 }
                 context.Model.AddCollectionToEntity(entity.name, map);
             }
         }
     }
 }
 private @class Wire(@class q)
 {
     List<object> items = new List<object>();
     if (propertiesMapByEntity.ContainsKey(q.name))
     {
         propertiesMapByEntity[q.name].ForEach(i => items.Add(i));
     }
     if (manyToOnesByEntity.ContainsKey(q.name))
     {
         manyToOnesByEntity[q.name].ForEach(i => items.Add(i)); ;
     }
     if (collectionsByEntity.ContainsKey(q.name))
     {
         collectionsByEntity[q.name].ForEach(i => items.Add(i)); ;
     }
     q.Items = items.ToArray();
     return q;
 }
 private void RemoveCurrentCollections(@class e)
 {
     var mtoones = context.Model.GetManyToOnesOfEntity(e.name);
     foreach (var c in mtoones)
     {
         var collections = context.Model.GetCollectionsOfEntity(c.@class);
         foreach (var toremove in collections)
         {
             if (IsOf(e, toremove))
             {
                 context.Model.RemoveCollectionFromEntity(c.@class, toremove);
             }
         }
     }
 }
 private bool IsOf(@class e, object toremove)
 {
     PropertyInfo pi = toremove.GetType().GetProperty("Item");
     if (null != pi)
     {
         onetomany theclass = pi.GetValue(toremove, null) as onetomany;
         return theclass != null && 0 == string.Compare(theclass.@class, e.name);
     }
     return false;
 }
 private bool IsManyToManyJoin(@class e)
 {
     // no properties and two many to ones is a many to many
     var props = context.Model.GetPropertyOfEntity(e.name);
     var mtoones = context.Model.GetManyToOnesOfEntity(e.name);
     return props.Length == 0 && mtoones.Length == 2;
 }