Ejemplo n.º 1
0
        protected T FindOrCreate <T>(Expression <Func <T, bool> > pred, bool returnExisting)
            where T : class, new()
        {
            var entity = EntityFactory.Find(pred, EntitySource);

            if (entity != null)
            {
                if (!returnExisting)
                {
                    return(null);
                }
                EntityFactory.Attach(entity);
                return(entity);
            }
            else
            {
                return(EntityFactory.Create <T>());
            }
        }