public RelationsModel GetRelationModelFromDatabaseLazyLoaded(RelationObject relationObject)
        {
            RelationsModel relationModelToReturn = new RelationsModel();

            LazyLoadRelationsModel(relationObject, relationModelToReturn);

            return relationModelToReturn;
        }
        public RelationsModel GetRelationModelFromTempRelatinoLazyLoaded(RelationObject relationObject)
        {
            RelationsModel relationModelToReturn = new RelationsModel();

            relationModelToReturn = GetRelationModelFromDatabaseLazyLoaded(relationObject);

            return relationModelToReturn;
        }
        public RelationsModel GetRelationModelFromDatabaseLazyLoaded(string relationObjectName)
        {
            RelationsModel relationModelToReturn = new RelationsModel();

            RelationObject relationObject = InternalDatabase.GetRelationByName(relationObjectName);

            relationModelToReturn = GetRelationModelFromDatabaseLazyLoaded(relationObject);

            return relationModelToReturn;
        }
        private void LazyLoadAttributesFromDatabaseToModel(RelationObject relationObject, RelationsModel relationModel)
        {
            IList<AttributesModel> attributesModelList = new List<AttributesModel>();

            foreach (AttributeObject attributeObject in relationObject.RelationAttributes)
            {
                AttributesModel attributeModelToAddToList = new AttributesModel();

                attributeModelToAddToList.Name = attributeObject.Name;
                attributeModelToAddToList.Type = attributeObject.Type;
                attributeModelToAddToList.Size = attributeObject.Size;

                attributesModelList.Add(attributeModelToAddToList);
            }

            relationModel.RelationAttributes = attributesModelList;
        }
        public IList<RelationsModel> GetAllRelationsFromDatabaseLazyLoad()
        {
            IList<RelationObject> ALL_DATABASE_RELATIONS = InternalDatabase.GetAllRelations();

            IList<RelationsModel> listOfRelationsModels = new List<RelationsModel>();

            if(ALL_DATABASE_RELATIONS != null)
            {
                foreach (RelationObject relationObject in ALL_DATABASE_RELATIONS)
                {
                    RelationsModel relationsModel = new RelationsModel();
                    LazyLoadRelationsModel(relationObject, relationsModel);
                    listOfRelationsModels.Add(relationsModel);
                }
            }

            return listOfRelationsModels;
        }
        public IList<RelationsModel> GetAllRelationModelFromDatabaseWithoutTuplesForView()
        {
            IList<RelationObject> ALL_DATABASE_RELATIONS = InternalDatabase.GetAllRelations();

            IList<RelationsModel> listOfRelationsModels = new List<RelationsModel>();

            if (ALL_DATABASE_RELATIONS != null)
            {
                foreach (RelationObject relationObject in ALL_DATABASE_RELATIONS)
                {
                    RelationsModel relationModel = new RelationsModel();
                    LoadAllRelationsWithAttributesAndName(relationObject, relationModel);
                    listOfRelationsModels.Add(relationModel);
                }
            }

            return listOfRelationsModels;
        }
 private void LoadAllRelationsWithAttributesAndName(RelationObject relationObject, RelationsModel relationModel)
 {
     LazyLoadAttributesFromDatabaseToModel(relationObject, relationModel);
     LazyLoadRelationName(relationObject, relationModel);
 }
        private void LazyLoadTuplesFromDatabaseToModel(RelationObject relationObject, RelationsModel relationModel)
        {
            IList<TuplesModel> tulesModelList = new List<TuplesModel>();

            if (relationObject.RelationsTuples != null)
            {
                foreach (TupleObject tupleObject in relationObject.RelationsTuples)
                {
                    TuplesModel tulesModel = new TuplesModel();

                    if (tupleObject.TupleCells != null)
                    {
                        foreach (TupleCellObject tupleCellObject in tupleObject.TupleCells)
                        {
                            tulesModel.TupleCells.Add(LazyTupleCellFromDatabaseForView(tupleCellObject));
                        }
                    }

                    tulesModelList.Add(tulesModel);
                }
            }

            relationModel.RelationsTuples = tulesModelList;
        }
 private void LazyLoadRelationsModel(RelationObject relationObject, RelationsModel relationModel)
 {
     LazyLoadAttributesFromDatabaseToModel(relationObject, relationModel);
     LazyLoadTuplesFromDatabaseToModel(relationObject, relationModel);
     LazyLoadRelationName(relationObject, relationModel);
 }
 private void LazyLoadRelationName(RelationObject relationObject, RelationsModel relationModel)
 {
     relationModel.NameOfRelation = relationObject.NameOfRelation;
 }