Esempio n. 1
0
        public IEntityRule GetDomainRule(string ruleName)
        {
            IEntityRule rule = default(IEntityRule);

            switch (ruleName)
            {
            //  case "SubCategory":
            //   case "TestEntity":
            //      rule = new TestViewModel();
            //     break;
            case "TestEntityError":
                rule = new TestEntityError();
                break;

            case "TestSubCategory":
                Moq.Mock <SubCategoryRules> _mockSubCategoryRules
                    = new Moq.Mock <SubCategoryRules>()
                    {
                    CallBase = false
                    };
                rule = _mockSubCategoryRules.Object;
                break;

            default:
                var _mock = new Moq.Mock <IServiceHandlerFactory>();
                rule = new TestEntityRule(_mock.Object);
                break;
            }

            return(rule);
        }
Esempio n. 2
0
        public IEntityRule GetDomainRule(Type t, IClientInfo clientInfo)
        {
            IEntityRule ret = default(IEntityRule);

            string ClientPrefix    = clientInfo.AssmPrefix;
            string DefaultPrefix   = clientInfo.DefaultPrefix;
            string ClientRuleName  = string.Format("{0}.Common.{1}Rules", clientInfo.AssmPrefix, t.Name);
            string DefaultRuleName = string.Format("Repos.Common.{0}Rules", t.Name);
            string RuleName        = string.Format("{0}Rules", t.Name);


            foreach (var strRule in new string[] { ClientRuleName, DefaultRuleName, RuleName })
            {
                ret = GetDomainRule(strRule);
                if (ret != null)
                {
                    break;
                }
            }


            //if (!String.IsNullOrEmpty(clientInfo.AssmPrefix) )
            //    ruleName = string.Format("{0}.{1}Rules", clientInfo.AssmPrefix, t.Name);
            //     ret = EngineContext
            //        .Current
            //        .ContainerManager
            //        .Resolve<IEntityRule>(key: ruleName, AllowNull: true);
            //    if (ret == null)
            //    ruleName = string.Format("Repos.Common.{0}Rules", t.Name);
            //else
            //    ruleName = string.Format("Repos.Common.{0}Rules", t.Name);


            if (ret == null)
            {
                throw new NotImplementedException("Rules For: " + t.Name + " is not implemented");
            }
            return(ret);
        }
Esempio n. 3
0
        public IEntityRule GetDomainRule(Type t, IClientInfo clientInfo)
        {
            string      ClientPrefix    = string.Empty;
            string      DefaultPrefix   = string.Empty;
            string      ClientRuleName  = string.Empty;
            string      DefaultRuleName = string.Empty;
            string      RuleName        = string.Empty;
            IEntityRule ret             = default(IEntityRule);

            GetClientInfo(t
                          , clientInfo
                          , out ClientPrefix
                          , out DefaultPrefix
                          , out ClientRuleName
                          , out DefaultRuleName
                          , out RuleName
                          );

            ret = GetDomainRules(t
                                 , clientInfo
                                 , new string[] { ClientRuleName, DefaultRuleName }).FirstOrDefault();

            return(ret);
        }
Esempio n. 4
0
 public TestServiceSubCategory(IRepository <SubCategory> subCategoryRepository
                               , IServiceEntityEdit <SubCategory> Edits
                               , IEntityRule RulesFactory)
     : base(subCategoryRepository, null, null, null)
 {
 }