chore: bumped dotnet version to 10

This commit is contained in:
2026-01-23 12:16:07 +03:00
parent 097f1897c2
commit 90e59802c6
32 changed files with 210 additions and 257 deletions

View File

@@ -10,46 +10,41 @@ public abstract class BaseEntity : IEntity
public Event<IHasStateEnable> OnStateEnableAssigned { get; } = new();
public Event<IAssignable> OnUnassigned { get; } = new();
private IStateEnable _stateEnable = null!;
private bool _initialized = false;
private string _id = string.Empty;
public virtual IStateEnable StateEnable => _stateEnable;
public virtual IStateEnable StateEnable { get; private set; } = null!;
public string Id
{
get => _id;
get;
set
{
if (IsInitialized)
throw new($"Can't change {nameof(Id)} of {_id} because it's initialized");
throw new($"Can't change {nameof(Id)} of {field} because it's initialized");
if (value == _id)
if (value == field)
return;
string previousId = _id;
string previousId = field;
_id = value;
field = value;
OnIdChanged?.Invoke(this, new(previousId));
}
}
} = string.Empty;
public bool IsInitialized
{
get => _initialized;
get;
private set
{
if (value == _initialized)
if (value == field)
return;
_initialized = value;
field = value;
if (value)
OnInitialized?.Invoke(this);
else
OnFinalized?.Invoke(this);
}
}
} = false;
protected virtual void OnAssign(IStateEnable stateEnable) { }
public bool Assign(IStateEnable stateEnable)
@@ -57,8 +52,8 @@ public abstract class BaseEntity : IEntity
if (IsInitialized)
return false;
_stateEnable = stateEnable;
_stateEnable.Assign(this);
StateEnable = stateEnable;
StateEnable.Assign(this);
OnAssign(stateEnable);
OnStateEnableAssigned?.Invoke(this);
return true;
@@ -72,8 +67,8 @@ public abstract class BaseEntity : IEntity
UnassignInternal();
_stateEnable = null!;
_stateEnable.Unassign();
StateEnable = null!;
StateEnable.Unassign();
OnUnassigned?.Invoke(this);
return true;
}
@@ -84,7 +79,7 @@ public abstract class BaseEntity : IEntity
if (IsInitialized)
return false;
_stateEnable ??= Factory.StateEnableFactory.Instantiate(this);
StateEnable ??= Factory.StateEnableFactory.Instantiate(this);
InitializeInternal();
@@ -104,6 +99,6 @@ public abstract class BaseEntity : IEntity
return true;
}
protected BaseEntity() => _id = Guid.NewGuid().ToString("D");
protected BaseEntity(string id) => _id = id;
protected BaseEntity() => Id = Guid.NewGuid().ToString("D");
protected BaseEntity(string id) => Id = id;
}