示例#1
0
 public static void Init(this IPersistentMemberInfo persistentMemberInfo, Type codeTemplateType, CodeDomProvider codeDomProvider)
 {
     persistentMemberInfo.CodeTemplateInfo.CodeTemplate = CodeTemplateBuilder.CreateDefaultTemplate(
         persistentMemberInfo is IPersistentCollectionMemberInfo
             ? TemplateType.XPCollectionMember
             : TemplateType.XPReadWritePropertyMember, persistentMemberInfo.Session, codeTemplateType, codeDomProvider);
 }
示例#2
0
        public static void SetDefaultTemplate(this IPersistentTemplatedTypeInfo persistentMemberInfo, TemplateType templateType)
        {
            var objectType = WCTypesInfo.Instance.FindBussinessObjectType <ICodeTemplateInfo>();

            persistentMemberInfo.CodeTemplateInfo = (ICodeTemplateInfo)objectType.CreateInstance(new object[] { persistentMemberInfo.Session });

            var defaultTemplate = CodeTemplateBuilder.CreateDefaultTemplate(templateType, persistentMemberInfo.Session,
                                                                            WCTypesInfo.Instance.FindBussinessObjectType <ICodeTemplate>(),
                                                                            GetProvider(persistentMemberInfo));

            persistentMemberInfo.CodeTemplateInfo.CodeTemplate = defaultTemplate;
            persistentMemberInfo.CodeTemplateInfo.CloneProperties();
        }
示例#3
0
        public static void SetDefaultTemplate(this IPersistentTemplatedTypeInfo persistentMemberInfo, TemplateType templateType)
        {
            var objectSpace = XPObjectSpace.FindObjectSpaceByObject(persistentMemberInfo);

            persistentMemberInfo.CodeTemplateInfo = objectSpace.CreateWCObject <ICodeTemplateInfo>();

            ICodeTemplate defaultTemplate = CodeTemplateBuilder.CreateDefaultTemplate(templateType, persistentMemberInfo.Session,
                                                                                      WCTypesInfo.Instance.FindBussinessObjectType <ICodeTemplate>(),
                                                                                      GetProvider(persistentMemberInfo));

            persistentMemberInfo.CodeTemplateInfo.CodeTemplate = defaultTemplate;
            persistentMemberInfo.CodeTemplateInfo.CloneProperties();
        }
示例#4
0
 public static void Init(this IPersistentClassInfo persistentClassInfo, Type codeTemplateType, CodeDomProvider codeDomProvider)
 {
     persistentClassInfo.CodeTemplateInfo.CodeTemplate = CodeTemplateBuilder.CreateDefaultTemplate(TemplateType.Class, persistentClassInfo.Session, codeTemplateType, codeDomProvider);
 }