コード例 #1
0
ファイル: SystemRequiredInfo.cs プロジェクト: kmeze/Rhetos
        public IEnumerable<IConceptInfo> CreateNewConcepts(IEnumerable<IConceptInfo> existingConcepts)
        {
            string filterName = "SystemRequired" + Property.Name;

            var filter = new ItemFilterInfo
            {
                Source = Property.DataStructure,
                FilterName = filterName,
                Expression = "item => item." + Property.Name + " == null"
            };

            var invalidData = new InvalidDataMarkPropertyInfo
            {
                Source = Property.DataStructure,
                FilterType = filterName,
                ErrorMessage = "System required property " +  Property.GetUserDescription() + " is not set.",
                DependedProperty = Property
            };

            var reloadBeforeValidations = new ReloadBeforeValidationsInfo
            {
                DataStructure = Property.DataStructure
            };

            return new IConceptInfo[] { filter, invalidData, reloadBeforeValidations };
        }
コード例 #2
0
        private static string ReloadSnippet(ReloadBeforeValidationsInfo info)
        {
            return string.Format(
            @"                _executionContext.NHibernateSession.Clear();
                for (int i=0; i<inserted.Length; i++) inserted[i] = _executionContext.NHibernateSession.Load<{0}.{1}>(inserted[i].ID);
                for (int i=0; i<updated.Length; i++) updated[i] = _executionContext.NHibernateSession.Load<{0}.{1}>(updated[i].ID);

            ",
            info.DataStructure.Module.Name,
            info.DataStructure.Name);
        }