Esempio n. 1
0
 public void Create() {
     Dictionary<string, ClassGeneratorInfo> generatorInfos = new ClassGenerator(_persistentAssemblyInfo, _storageTables).CreateAll().ToDictionary(classGeneratorInfo => classGeneratorInfo.PersistentClassInfo.Name);
     foreach (var classGeneratorInfo in generatorInfos.Where(pair => pair.Value.PersistentClassInfo.CodeTemplateInfo.CodeTemplate.TemplateType == TemplateType.Class)) {
         var generatorInfo = classGeneratorInfo.Value;
         new ClassAtrributeGenerator(generatorInfo, _logonObject.NavigationPath).Create().Each(info => generatorInfo.PersistentClassInfo.TypeAttributes.Add(info));
         var memberGeneratorInfos = new MemberGenerator(classGeneratorInfo.Value.DbTable, generatorInfos).Create();
         memberGeneratorInfos.Each(info => new MemberAttributeGenerator(info, generatorInfo).Create());
     }
     var oneToOneMemberInfos = _persistentAssemblyInfo.PersistentClassInfos.SelectMany(info => info.OwnMembers.OfType<IPersistentReferenceMemberInfo>()).Where(info => info.CodeTemplateInfo.CodeTemplate.TemplateType == TemplateType.XPOneToOnePropertyMember);
     foreach (var oneToOneMemberInfo in oneToOneMemberInfos) {
         var codeTemplate = _objectSpace.CreateWCObject<ICodeTemplate>();
         codeTemplate.TemplateCode = oneToOneMemberInfo.ReferenceClassInfo.OwnMembers.OfType<IPersistentReferenceMemberInfo>().Single(info => info.CodeTemplateInfo.CodeTemplate.TemplateType == TemplateType.XPOneToOnePropertyMember).Name;
         oneToOneMemberInfo.TemplateInfos.Add(codeTemplate);
     }
     CodeEngine.SupportCompositeKeyPersistentObjects(_persistentAssemblyInfo);
     CreateAssemblyAttributes();
 }
Esempio n. 2
0
        public void Create()
        {
            Dictionary <string, ClassGeneratorInfo> generatorInfos = new ClassGenerator(_persistentAssemblyInfo, _storageTables).CreateAll().ToDictionary(classGeneratorInfo => classGeneratorInfo.PersistentClassInfo.Name);

            foreach (var classGeneratorInfo in generatorInfos.Where(pair => pair.Value.PersistentClassInfo.CodeTemplateInfo.CodeTemplate.TemplateType == TemplateType.Class))
            {
                var generatorInfo = classGeneratorInfo.Value;
                new ClassAtrributeGenerator(generatorInfo, _logonObject.NavigationPath).Create().Each(info => generatorInfo.PersistentClassInfo.TypeAttributes.Add(info));
                var memberGeneratorInfos = new MemberGenerator(classGeneratorInfo.Value.DbTable, generatorInfos).Create();
                memberGeneratorInfos.Each(info => new MemberAttributeGenerator(info, generatorInfo).Create());
            }
            var oneToOneMemberInfos = _persistentAssemblyInfo.PersistentClassInfos.SelectMany(info => info.OwnMembers.OfType <IPersistentReferenceMemberInfo>()).Where(info => info.CodeTemplateInfo.CodeTemplate.TemplateType == TemplateType.XPOneToOnePropertyMember);

            foreach (var oneToOneMemberInfo in oneToOneMemberInfos)
            {
                var codeTemplate = _objectSpace.CreateWCObject <ICodeTemplate>();
                codeTemplate.TemplateCode = oneToOneMemberInfo.ReferenceClassInfo.OwnMembers.OfType <IPersistentReferenceMemberInfo>().Single(info => info.CodeTemplateInfo.CodeTemplate.TemplateType == TemplateType.XPOneToOnePropertyMember).Name;
                oneToOneMemberInfo.TemplateInfos.Add(codeTemplate);
            }
            CodeEngine.SupportCompositeKeyPersistentObjects(_persistentAssemblyInfo);
            CreateAssemblyAttributes();
        }