コード例 #1
0
ファイル: Utility.cs プロジェクト: uQr/Visual-NHibernate
        public static string CreateMappingXMLFrom(
													Entity entity,
													string assemblyName,
													string entityNamespace,
													bool autoImport,
													TopLevelAccessTypes defaultAccess,
													TopLevelCascadeTypes defaultCascade,
													bool defaultLazy)
        {
            hibernatemapping hm = new hibernatemapping
                                    {
                                        @namespace = entityNamespace,
                                        assembly = assemblyName,
                                        autoimport = autoImport
                                    };

            if (defaultAccess != TopLevelAccessTypes.property)
                hm.defaultaccess = defaultAccess.ToString();

            if (defaultCascade != TopLevelCascadeTypes.none)
                hm.defaultcascade = defaultCascade.ToString().Replace("_", "-");

            if (!defaultLazy)
                hm.defaultlazy = defaultLazy;

            EntityMapper mapper = new EntityMapper();
            var newClass = mapper.ProcessEntity(entity);
            hm.AddClass(newClass);
            return hm.ToXml().Replace(@"xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" ", "").Replace(@"xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" ", "");
        }
コード例 #2
0
ファイル: Utility.cs プロジェクト: windygu/Visual-NHibernate
        public static string CreateMappingXMLFrom(
            Entity entity,
            string assemblyName,
            string entityNamespace,
            bool autoImport,
            TopLevelAccessTypes defaultAccess,
            TopLevelCascadeTypes defaultCascade,
            bool defaultLazy)
        {
            hibernatemapping hm = new hibernatemapping
            {
                @namespace = entityNamespace,
                assembly   = assemblyName,
                autoimport = autoImport
            };

            if (defaultAccess != TopLevelAccessTypes.property)
            {
                hm.defaultaccess = defaultAccess.ToString();
            }

            if (defaultCascade != TopLevelCascadeTypes.none)
            {
                hm.defaultcascade = defaultCascade.ToString().Replace("_", "-");
            }

            if (!defaultLazy)
            {
                hm.defaultlazy = defaultLazy;
            }

            EntityMapper mapper   = new EntityMapper();
            var          newClass = mapper.ProcessEntity(entity);

            hm.AddClass(newClass);
            return(hm.ToXml().Replace(@"xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" ", "").Replace(@"xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" ", ""));
        }
コード例 #3
0
 public static bool DefaultAccess_IsValid(TopLevelAccessTypes value, out string failReason)
 {
     failReason = "";
     return(true);
 }