Esempio n. 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());
        }
Esempio n. 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);
        }
Esempio n. 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());
        }
Esempio n. 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);
        }
Esempio n. 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]);
        }
Esempio n. 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]);
        }
Esempio n. 7
0
 public static NrdoQuery GetQuery(string name)
 {
     return(NrdoReflection.GetCodeBase(Assembly.GetCallingAssembly()).GetQuery(name));
 }
Esempio n. 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);
 }
Esempio n. 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);
 }
Esempio n. 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);
 }
Esempio n. 11
0
 public static NrdoQuery GetQuery(ILookupAssemblies lookup, string name)
 {
     return(NrdoReflection.GetCodeBase(lookup).GetQuery(name));
 }
Esempio n. 12
0
 public static IDictionary <string, string> GetRenameMapping(ILookupAssemblies lookup)
 {
     return(NrdoReflection.GetCodeBase(lookup).GetTableRenameMapping());
 }
Esempio n. 13
0
 public static NrdoQuery GetQuery(Assembly assembly, string name)
 {
     return(NrdoReflection.GetCodeBase(assembly).GetQuery(name));
 }
Esempio n. 14
0
 public static INrdoCodeBase GetCodeBase(Assembly assembly)
 {
     return(GetCodeBase(NrdoReflection.GetLookupStrategy(assembly)));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }
Esempio n. 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));
 }