Example #1
0
        /// <param name="libraryName">If null then changes to library '(GLOBAL)'</param>
        public UnifaceObjectId(UnifaceObjectType type, string libraryName, string objectName)
        {
            if (string.IsNullOrEmpty(objectName))
            {
                throw new ArgumentException("objectName was not specified", nameof(objectName));
            }

            Type        = type ?? throw new ArgumentNullException(nameof(type));
            LibraryName = String.IsNullOrEmpty(libraryName) ? _libraryNameGlobal : libraryName?.Trim();
            ObjectName  = objectName.Trim();
        }
Example #2
0
        /// <summary>
        /// Path uniquely identifies a Uniface objects.
        /// Typically of the format Type\Library\ObjectName.
        /// This will point to a folder that contains the actual .uni files.
        /// </summary>
        public static UnifaceObjectId Parse(string path)
        {
            var foldersHierarchy = path.Split(new[] { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar }, count: 3);

            if (foldersHierarchy.Length == 3 && foldersHierarchy.All(_ => !String.IsNullOrEmpty(_)))
            {
                var type = UnifaceObjectType.Get(foldersHierarchy[0]);

                return(new UnifaceObjectId(type, libraryName: foldersHierarchy[1], objectName: foldersHierarchy[2]));
            }

            throw new FormatException($@"'{path}' expected format is 'Type/Library/ObjectName'");
        }
 internal static UnifaceObjectTypeTableSource Get(UnifaceObjectType type)
 {
     return(_all[type]);
 }
Example #4
0
 private static UnifaceObjectId GetUnifaceObjectId(SqlDataReader reader, UnifaceObjectType type)
 {
     return(new UnifaceObjectId(type, reader[type.SourceCode.LibraryField].ToString(), reader[type.SourceCode.IdField].ToString()));
 }
Example #5
0
 private static UnifaceObject GetUnifaceObject(SqlDataReader reader, UnifaceObjectType type)
 {
     return(new UnifaceObject(GetUnifaceObjectId(reader, type)));
 }