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