示例#1
0
        string IDfnElement.ToDfnSyntax()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("      " + NrdoReflection.GetTypeString(Type) + " " + Name + " ");
            if (DbType != null)
            {
                sb.Append(DbType + " ");
            }
            sb.Append(IsNullable ? "nullable" : "notnull");
            sb.Append(" []");
            return(sb.ToString());
        }
示例#2
0
        /// <summary>
        /// Gets a NrdoTable object corresponding to the given type.
        /// </summary>
        /// <param name="type">The type corresponding to the table to get</param>
        /// <returns>A NrdoTable object corresponding to the given type</returns>
        public static NrdoTable GetTable(Type type)
        {
            Assembly assembly = type.Assembly;
            string   name     = NrdoCodeBase.getTableNameFromType(type);

            if (name == null || NrdoReflection.MangleName(assembly, name) != type.FullName)
            {
                throw new ArgumentException(type.FullName + " is not a valid nrdo database table class: " + name + " mangles to " + NrdoReflection.MangleName(assembly, name));
            }
            NrdoTable result = NrdoCodeBase.getTableInternal(assembly, name, type);

            if (result == null)
            {
                throw new ArgumentException(type.FullName + " is not a valid nrdo database table class");
            }
            return(result);
        }
示例#3
0
        string IDfnElement.ToDfnSyntax()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("    " + NrdoReflection.GetTypeString(NonNullableType) + " " + Name + " ");
            if (DbType != null)
            {
                sb.Append(DbType + " ");
            }
            sb.Append(IsNullable ? "nullable " : "notnull ");
            if (!(container is NrdoQuery))
            {
                sb.Append(IsWritable ? "readwrite " : "readonly ");
            }
            sb.Append("[]");
            return(sb.ToString());
        }
示例#4
0
        public static NrdoQuery GetQuery(Type type)
        {
            Assembly assembly = type.Assembly;
            string   name     = NrdoCodeBase.getQueryNameFromType(type);
            var      mangled  = name == null ? null : NrdoReflection.MangleName(assembly, name);

            if (name == null || mangled != type.FullName)
            {
                throw new ArgumentException(type.FullName + " is not a valid nrdo database query class (name = " + (name ?? "null") + ", mangled = " + (mangled ?? "null") + ")");
            }
            NrdoQuery result = NrdoCodeBase.getQueryInternal(assembly, name, type);

            if (result == null)
            {
                throw new ArgumentException(type.FullName + " is not a valid nrdo database query class");
            }
            return(result);
        }
示例#5
0
        internal static NrdoTable getTableInternal(Assembly assembly, string name, Type type)
        {
            if (!TablesByAssembly.ContainsKey(assembly))
            {
                if (NrdoReflection.GetNsBase(assembly) == null)
                {
                    return(null);
                }
                TablesByAssembly[assembly] = new Dictionary <string, NrdoTable>();
            }
            Dictionary <string, NrdoTable> tables = TablesByAssembly[assembly];

            if (!tables.ContainsKey(name))
            {
                if (type == null)
                {
                    type = assembly.GetType(NrdoReflection.MangleName(assembly, name));
                }
                tables[name] = (type == null ? null : new NrdoTable(type));
            }
            return(tables[name]);
        }
示例#6
0
        internal static NrdoQuery getQueryInternal(Assembly assembly, string name, Type type)
        {
            if (!queriesByAssembly.ContainsKey(assembly))
            {
                if (NrdoReflection.GetNsBase(assembly) == null)
                {
                    return(null);
                }
                queriesByAssembly[assembly] = new Dictionary <string, NrdoQuery>();
            }
            Dictionary <string, NrdoQuery> queries = queriesByAssembly[assembly];

            if (!queries.ContainsKey(name))
            {
                if (type == null)
                {
                    type = assembly.GetType(NrdoReflection.MangleName(assembly, name));
                }
                queries[name] = (type == null ? null : new NrdoQuery(type));
            }
            return(queries[name]);
        }
示例#7
0
 public static NrdoQuery GetQuery(string name)
 {
     return(NrdoReflection.GetCodeBase(Assembly.GetCallingAssembly()).GetQuery(name));
 }
示例#8
0
 /// <summary>
 /// Gets all known tables. To determine which assemblies to load from, the given lookup strategy is used.
 /// </summary>
 /// <param name="lookup">The lookup strategy to use to find the appropriate assembly</param>
 /// <returns>NrdoTable objects corresponding to all known tables</returns>
 public static IEnumerable <NrdoQuery> GetAllQueries(ILookupAssemblies lookup)
 {
     return(NrdoReflection.GetCodeBase(lookup).AllQueries);
 }
示例#9
0
 /// <summary>
 /// Gets all known tables. To determine which assemblies to load from, the default lookup strategy of the calling
 /// assembly is used.
 /// </summary>
 /// <returns>NrdoTable objects corresponding to all known tables</returns>
 public static IEnumerable <NrdoQuery> GetAllQueries()
 {
     return(NrdoReflection.GetCodeBase(Assembly.GetCallingAssembly()).AllQueries);
 }
示例#10
0
 /// <summary>
 /// Gets all known tables. To determine which assemblies to load from, the default lookup strategy of the given
 /// assembly is used.
 /// </summary>
 /// <param name="assembly">The assembly to use the default lookup strategy of. Note that the assembly's strategy might in theory NOT actually say to look in itself first, or at all.</param>
 /// <returns>NrdoTable objects corresponding to all known tables</returns>
 public static IEnumerable <NrdoQuery> GetAllQueries(Assembly assembly)
 {
     return(NrdoReflection.GetCodeBase(assembly).AllQueries);
 }
示例#11
0
 public static NrdoQuery GetQuery(ILookupAssemblies lookup, string name)
 {
     return(NrdoReflection.GetCodeBase(lookup).GetQuery(name));
 }
示例#12
0
 public static IDictionary <string, string> GetRenameMapping(ILookupAssemblies lookup)
 {
     return(NrdoReflection.GetCodeBase(lookup).GetTableRenameMapping());
 }
示例#13
0
 public static NrdoQuery GetQuery(Assembly assembly, string name)
 {
     return(NrdoReflection.GetCodeBase(assembly).GetQuery(name));
 }
示例#14
0
 public static INrdoCodeBase GetCodeBase(Assembly assembly)
 {
     return(GetCodeBase(NrdoReflection.GetLookupStrategy(assembly)));
 }
示例#15
0
 /// <summary>
 /// Gets a NrdoTable object corresponding to the given table name. To determine which assembly to load from, the default
 /// lookup strategy of the calling assembly is used.
 /// </summary>
 /// <param name="name">The name of the table to get</param>
 /// <returns>A NrdoTable object corresponding to the named table</returns>
 public static NrdoTable GetTable(string name)
 {
     return(NrdoReflection.GetCodeBase(Assembly.GetCallingAssembly()).GetTable(name));
 }
示例#16
0
 /// <summary>
 /// Gets a NrdoTable object corresponding to the given table name. To determine which assembly to load from, the given
 /// lookup strategy is used.
 /// </summary>
 /// <param name="lookup">The lookup strategy to use to find the appropriate assembly</param>
 /// <param name="name">The name of the table to get</param>
 /// <returns>A NrdoTable object corresponding to the named table</returns>
 public static NrdoTable GetTable(ILookupAssemblies lookup, string name)
 {
     return(NrdoReflection.GetCodeBase(lookup).GetTable(name));
 }
示例#17
0
 /// <summary>
 /// Gets a NrdoTable object corresponding to the given table name. To determine which assembly to load from, the default
 /// lookup strategy of the given assembly is used.
 /// </summary>
 /// <param name="assembly">The assembly to use the default lookup strategy of. Note that the assembly's strategy might in theory NOT actually say to look in itself first, or at all.</param>
 /// <param name="name">The name of the table to get</param>
 /// <returns>A NrdoTable object corresponding to the named table</returns>
 public static NrdoTable GetTable(Assembly assembly, string name)
 {
     return(NrdoReflection.GetCodeBase(assembly).GetTable(name));
 }