Exemplo n.º 1
0
        }        //

        public static List <ThisEntity> GetAll(Guid parentUid, bool getMinimumOnly = false)
        {
            ThisEntity        entity = new ThisEntity();
            List <ThisEntity> list   = new List <ThisEntity>();
            Entity            parent = EntityManager.GetEntity(parentUid);

            if (parent == null || parent.Id == 0)
            {
                return(list);
            }

            try
            {
                using (var context = new EntityContext())
                {
                    //context.Configuration.LazyLoadingEnabled = false;

                    List <DBEntity> results = context.Entity_ReferenceFramework
                                              .Where(s => s.EntityId == parent.Id)
                                              .OrderBy(s => s.CategoryId)
                                              .ThenBy(s => s.Created)
                                              .ToList();

                    if (results != null && results.Count > 0)
                    {
                        foreach (DBEntity item in results)
                        {
                            entity = new ThisEntity();
                            //TBD
                            //MapFromDB( item, entity );
                            list.Add(entity);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingHelper.LogError(ex, thisClassName + ".GetAll");
            }
            return(list);
        }        //
Exemplo n.º 2
0
        public static bool Exists(int entityId, int referenceFrameworkId)
        {
            ThisEntity entity = new ThisEntity();

            try
            {
                using (var context = new EntityContext())
                {
                    DBEntity item = context.Entity_ReferenceFramework
                                    .FirstOrDefault(s => s.EntityId == entityId && s.ReferenceFrameworkId == referenceFrameworkId);

                    if (item != null && item.Id > 0)
                    {
                        return(true);
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingHelper.LogError(ex, thisClassName + ".Exists");
            }
            return(false);
        }        //