Some fixes

This commit is contained in:
Marc Hernandez 2024-06-10 15:16:16 -07:00
parent 7fbfc446d5
commit db949e14ab
2 changed files with 14 additions and 14 deletions

View File

@ -17,49 +17,49 @@ namespace db
public int Line { get; private set; } = -1; public int Line { get; private set; } = -1;
public string Member { get; private set; } = ""; public string Member { get; private set; } = "";
private Act( Func<CommitResults> act, string debugInfo = "{unknown_base}", string path = "", int line = -1, string member = "" ) private Act( Func<CommitResults> act, string reason = "{unknown_base}", string dbgPath = "", int dbgLine = -1, string dbgMethod = "" )
{ {
m_act = act; m_act = act;
DebugInfo = debugInfo; DebugInfo = reason;
Path = path; Path = dbgPath;
Line = line; Line = dbgLine;
Member = member; Member = dbgMethod;
//ExtractValue( act ); //ExtractValue( act );
} }
static public Act create( Func<CommitResults> act, string debugInfo = "{unknown}", [CallerFilePath] string path = "", [CallerLineNumber] int line = -1, [CallerMemberName] string member = "" ) static public Act create( Func<CommitResults> act, string reason = "{unknown}", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1, [CallerMemberName] string dbgMethod = "" )
{ {
//ExtractValue( act ); //ExtractValue( act );
return new Act( act, debugInfo, path, line, member ); return new Act( act, reason, dbgPath, dbgLine, dbgMethod );
} }
public static Act create<T>( Func<T, CommitResults> act, T p0, string debugInfo = "{unknown}", [CallerFilePath] string path = "", [CallerLineNumber] int line = -1, [CallerMemberName] string member = "" ) public static Act create<T>( Func<T, CommitResults> act, T p0, string reason = "{unknown}", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1, [CallerMemberName] string dbgMethod = "" )
{ {
//ExtractValue( act ); //ExtractValue( act );
//return new Act( act ); //return new Act( act );
return new Act( () => { return act( p0 ); }, debugInfo, path, line, member ); return new Act( () => { return act( p0 ); }, reason, dbgPath, dbgLine, dbgMethod );
} }
// If we're not doing any commit ops we can just use these. // If we're not doing any commit ops we can just use these.
static public Act create( Action act, string debugInfo = "{unknown}", [CallerFilePath] string path = "", [CallerLineNumber] int line = -1, [CallerMemberName] string member = "" ) static public Act create( Action act, string reason = "{unknown}", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1, [CallerMemberName] string dbgMethod = "" )
{ {
//ExtractValue( act ); //ExtractValue( act );
return new Act( () => { act(); return CommitResults.Perfect; }, debugInfo, path, line, member ); return new Act( () => { act(); return CommitResults.Perfect; }, reason, dbgPath, dbgLine, dbgMethod );
} }
public static Act create<T>( Action<T> act, T p0, string debugInfo = "{unknown}", [CallerFilePath] string path = "", [CallerLineNumber] int line = -1, [CallerMemberName] string member = "" ) public static Act create<T>( Action<T> act, T p0, string reason = "{unknown}", [CallerFilePath] string dbgPath = "", [CallerLineNumber] int dbgLine = -1, [CallerMemberName] string dbgMethod = "" )
{ {
//ExtractValue( act ); //ExtractValue( act );
//return new Act( act ); //return new Act( act );
return new Act( () => { act( p0 ); return CommitResults.Perfect; }, debugInfo, path, line, member ); return new Act( () => { act( p0 ); return CommitResults.Perfect; }, reason, dbgPath, dbgLine, dbgMethod );
} }

View File

@ -40,7 +40,7 @@ public class DB<TID, T> where T : IID<TID>
LogGC.RegisterObjectId( m_lock ); LogGC.RegisterObjectId( m_lock );
} }
// @@@@ TODO This returns an entity that can be changing. It should be a lazy instantiated copy
public Option<T> lookup( TID id ) public Option<T> lookup( TID id )
{ {
if( m_objs.TryGetValue( id, out T obj ) ) if( m_objs.TryGetValue( id, out T obj ) )