Пример #1
0
        /// <summary>
        /// Asserts that each of this instances <see cref="ListProperties"/> is represented
        /// on the drive as an hbm.xml file.
        /// </summary>
        /// <returns></returns>
        public bool IsAllListHbmXmlPresent()
        {
            if (ListProperties == null || !ListProperties.Any())
            {
                return(true);
            }
            foreach (var fk in ListProperties.Keys)
            {
                var hbmXml = Compose.HbmFileNameFromAsmQualTypeName(ListProperties[fk], true);
                if (!File.Exists(hbmXml))
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #2
0
        internal static HbmFileContent GetHbmFileContentFromDictionary(Dictionary <Tuple <string, string>, HbmFileContent> includedTypes, Tuple <string, string> myNameOtherName)
        {
            if (includedTypes == null || string.IsNullOrWhiteSpace(myNameOtherName?.Item1) || string.IsNullOrWhiteSpace(myNameOtherName.Item2))
            {
                return(null);
            }

            var otherTypeFullName = myNameOtherName.Item2;
            var myFullName        = myNameOtherName.Item1;
            var myIncludedTypeKey = new Tuple <string, string>(myFullName, otherTypeFullName);

            //test if this has been done already
            HbmFileContent otherHbmContent = null;

            if (includedTypes.ContainsKey(myIncludedTypeKey))
            {
                return(null);
            }

            //imporve performance by looking for hbm file content already parsed when available
            otherHbmContent =
                includedTypes.FirstOrDefault(x => includedTypes[x.Key].AssemblyQualifiedTypeName == otherTypeFullName).Value;

            if (otherHbmContent == null)
            {
                var fkHbmXml = Compose.HbmFileNameFromAsmQualTypeName(otherTypeFullName, true);
                if (File.Exists(fkHbmXml))
                {
                    otherHbmContent = new HbmFileContent(fkHbmXml);
                }
            }

            //now hove both this hbm file content and the other's in scope
            if (otherHbmContent == null)
            {
                return(null);
            }
            includedTypes.Add(myIncludedTypeKey, otherHbmContent);

            return(otherHbmContent);
        }