N0b0dy
N0b0dy
CC#
Created by N0b0dy on 8/5/2024 in #help
Certain services could not be instantiated due to iss
thanks for the help. it makes a lot of sense.
38 replies
CC#
Created by N0b0dy on 8/5/2024 in #help
Certain services could not be instantiated due to iss
make sense
38 replies
CC#
Created by N0b0dy on 8/5/2024 in #help
Certain services could not be instantiated due to iss
i do not need base class repo here?
38 replies
CC#
Created by N0b0dy on 8/5/2024 in #help
Certain services could not be instantiated due to iss
little bit lost here. could you please elaborate more?
38 replies
CC#
Created by N0b0dy on 8/5/2024 in #help
Certain services could not be instantiated due to iss
is the base class has any problem?
38 replies
CC#
Created by N0b0dy on 8/5/2024 in #help
Certain services could not be instantiated due to iss
this is my base class
38 replies
CC#
Created by N0b0dy on 8/5/2024 in #help
Certain services could not be instantiated due to iss
ok
38 replies
CC#
Created by N0b0dy on 8/5/2024 in #help
Certain services could not be instantiated due to iss
38 replies
CC#
Created by N0b0dy on 8/5/2024 in #help
Certain services could not be instantiated due to iss
builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));
Already added that line and removed dbcontext from the repo. But same error.
38 replies
CC#
Created by N0b0dy on 8/5/2024 in #help
Certain services could not be instantiated due to iss
@Pobiega
System.AggregateException: 'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: UserServices.Interface.IDepartmentRepository Lifetime: Scoped ImplementationType: UserServices.Repositories.DepartmentRepository': Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContext' while attempting to activate 'UserServices.Repositories.DepartmentRepository'.)'
System.AggregateException: 'Some services are not able to be constructed (Error while validating the service descriptor 'ServiceType: UserServices.Interface.IDepartmentRepository Lifetime: Scoped ImplementationType: UserServices.Repositories.DepartmentRepository': Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContext' while attempting to activate 'UserServices.Repositories.DepartmentRepository'.)'
this is actual error mesage
38 replies
CC#
Created by N0b0dy on 8/20/2022 in #help
[Help] understanding Architecture of a parcel system
No , does not but fixed these errors
87 replies
CC#
Created by N0b0dy on 8/21/2022 in #help
Get method for API
@Scratch function to update state?
7 replies
CC#
Created by N0b0dy on 8/20/2022 in #help
[Help] understanding Architecture of a parcel system
@aes please review my code
87 replies
CC#
Created by N0b0dy on 8/20/2022 in #help
[Help] understanding Architecture of a parcel system
/// <summary>
/// The 'Base' abstract class
/// </summary>
public abstract class DeliverySystem

{

private StandardDeliveryContext standardDeliveryContext;

public DeliverySystem(StandardDeliveryContext _standardDeliveryContext)
{

this.standardDeliveryContext = _standardDeliveryContext;

}


}
/// <summary>
/// The 'Base' abstract class
/// </summary>
public abstract class DeliverySystem

{

private StandardDeliveryContext standardDeliveryContext;

public DeliverySystem(StandardDeliveryContext _standardDeliveryContext)
{

this.standardDeliveryContext = _standardDeliveryContext;

}


}
87 replies
CC#
Created by N0b0dy on 8/20/2022 in #help
[Help] understanding Architecture of a parcel system
public class Delivered : DeliverySystem, IOrderState

{

private readonly StandardDeliveryContext standardDelivery;
public DateTime deliveryDate { get; set; }


public Delivered(StandardDeliveryContext _standardDelivery) : base(_standardDelivery)
{

this.standardDelivery = _standardDelivery;

}


public DateTime PreparedOrder(DateTime placedOrderDate)
{
throw new NotImplementedException("Data");
}

public DateTime DispatchOrder(DateTime placedOrderDate)
{
throw new NotImplementedException("Data");
}
public DateTime DeliveredOrder(DateTime placedOrderDate)
{
standardDelivery.State = StandardDeliveryState.Delivered;
// placedOrderDate = standardDelivery.placedOrderDate.AddDays(1);
return placedOrderDate.AddDays(1);
}
}
public class Delivered : DeliverySystem, IOrderState

{

private readonly StandardDeliveryContext standardDelivery;
public DateTime deliveryDate { get; set; }


public Delivered(StandardDeliveryContext _standardDelivery) : base(_standardDelivery)
{

this.standardDelivery = _standardDelivery;

}


public DateTime PreparedOrder(DateTime placedOrderDate)
{
throw new NotImplementedException("Data");
}

public DateTime DispatchOrder(DateTime placedOrderDate)
{
throw new NotImplementedException("Data");
}
public DateTime DeliveredOrder(DateTime placedOrderDate)
{
standardDelivery.State = StandardDeliveryState.Delivered;
// placedOrderDate = standardDelivery.placedOrderDate.AddDays(1);
return placedOrderDate.AddDays(1);
}
}
87 replies
CC#
Created by N0b0dy on 8/20/2022 in #help
[Help] understanding Architecture of a parcel system
public class Dispatched : DeliverySystem, IOrderState

{

private readonly StandardDeliveryContext standardDelivery;
public DateTime dispatchDate { get; set; }


public Dispatched(StandardDeliveryContext _standardDelivery) : base(_standardDelivery)

{

this.standardDelivery = _standardDelivery;

}


public DateTime PreparedOrder(DateTime placedOrderDate)
{
throw new NotImplementedException("Data");
}

public DateTime DispatchOrder(DateTime placedOrderDate)
{
standardDelivery.State = StandardDeliveryState.Dispatched;
//standardDelivery.placedOrderDate = standardDelivery.placedOrderDate.AddDays(1);
return placedOrderDate.AddDays(1);
}
public DateTime DeliveredOrder(DateTime placedOrderDate)
{
throw new NotImplementedException("Data");
}
}
public class Dispatched : DeliverySystem, IOrderState

{

private readonly StandardDeliveryContext standardDelivery;
public DateTime dispatchDate { get; set; }


public Dispatched(StandardDeliveryContext _standardDelivery) : base(_standardDelivery)

{

this.standardDelivery = _standardDelivery;

}


public DateTime PreparedOrder(DateTime placedOrderDate)
{
throw new NotImplementedException("Data");
}

public DateTime DispatchOrder(DateTime placedOrderDate)
{
standardDelivery.State = StandardDeliveryState.Dispatched;
//standardDelivery.placedOrderDate = standardDelivery.placedOrderDate.AddDays(1);
return placedOrderDate.AddDays(1);
}
public DateTime DeliveredOrder(DateTime placedOrderDate)
{
throw new NotImplementedException("Data");
}
}
87 replies
CC#
Created by N0b0dy on 8/20/2022 in #help
[Help] understanding Architecture of a parcel system
public class Prepared : DeliverySystem, IOrderState

{

private readonly StandardDeliveryContext standardDelivery;
public DateTime preparedDate { get; set; }


public Prepared(StandardDeliveryContext _standardDelivery) : base(_standardDelivery)

{

this.standardDelivery = _standardDelivery;

}


public DateTime PreparedOrder(DateTime placedOrderDate)
{
standardDelivery.State = StandardDeliveryState.Prepared;
// standardDelivery.placedOrderDate = standardDelivery.placedOrderDate.AddDays(1);
return placedOrderDate.AddDays(1);
}

public DateTime DispatchOrder(DateTime placedOrderDate)
{
throw new NotImplementedException("Data");
}


public DateTime DeliveredOrder(DateTime placedOrderDate)
{
throw new NotImplementedException("Data");
}
}
public class Prepared : DeliverySystem, IOrderState

{

private readonly StandardDeliveryContext standardDelivery;
public DateTime preparedDate { get; set; }


public Prepared(StandardDeliveryContext _standardDelivery) : base(_standardDelivery)

{

this.standardDelivery = _standardDelivery;

}


public DateTime PreparedOrder(DateTime placedOrderDate)
{
standardDelivery.State = StandardDeliveryState.Prepared;
// standardDelivery.placedOrderDate = standardDelivery.placedOrderDate.AddDays(1);
return placedOrderDate.AddDays(1);
}

public DateTime DispatchOrder(DateTime placedOrderDate)
{
throw new NotImplementedException("Data");
}


public DateTime DeliveredOrder(DateTime placedOrderDate)
{
throw new NotImplementedException("Data");
}
}
87 replies
CC#
Created by N0b0dy on 8/20/2022 in #help
[Help] understanding Architecture of a parcel system
public enum StandardDeliveryState
{
Placed,
Prepared,
Dispatched,
Delivered,
}

public class StandardDeliveryContext: IOrderState
{
public static OrderRepository OrderRepository { get; set; }

public static void Init(OrderRepository _orderRepository)

{

OrderRepository = _orderRepository;

}


public int customerId { get; set; }

public int orderId { get; set; }

public DateTime placedOrderDate { get; set; }

private IOrderState process;

private StandardDeliveryState state;
public StandardDeliveryState State
{
get => state;
set
{
state = value;

switch (state)
{

case StandardDeliveryState.Placed:
process = new PreparedOrder(this);
break;

case StandardDeliveryState.Dispatched:
process = new DispatchOrder(this);
break;

case StandardDeliveryState.Delivered:
process = new Delivered(this);
break;
}
}
}

public void PreparedOrder(this)
{
process.PreparedOrder(placedOrderDate);
}

public void DispatchOrder(DateTime placedOrderDate)
{
process.DispatchOrder(placedOrderDate);
}
public void Delivered(DateTime placedOrderDate)
{
process.Delivered(placedOrderDate);
}
}
public enum StandardDeliveryState
{
Placed,
Prepared,
Dispatched,
Delivered,
}

public class StandardDeliveryContext: IOrderState
{
public static OrderRepository OrderRepository { get; set; }

public static void Init(OrderRepository _orderRepository)

{

OrderRepository = _orderRepository;

}


public int customerId { get; set; }

public int orderId { get; set; }

public DateTime placedOrderDate { get; set; }

private IOrderState process;

private StandardDeliveryState state;
public StandardDeliveryState State
{
get => state;
set
{
state = value;

switch (state)
{

case StandardDeliveryState.Placed:
process = new PreparedOrder(this);
break;

case StandardDeliveryState.Dispatched:
process = new DispatchOrder(this);
break;

case StandardDeliveryState.Delivered:
process = new Delivered(this);
break;
}
}
}

public void PreparedOrder(this)
{
process.PreparedOrder(placedOrderDate);
}

public void DispatchOrder(DateTime placedOrderDate)
{
process.DispatchOrder(placedOrderDate);
}
public void Delivered(DateTime placedOrderDate)
{
process.Delivered(placedOrderDate);
}
}
87 replies
CC#
Created by N0b0dy on 8/20/2022 in #help
[Help] understanding Architecture of a parcel system
hi I have implemented following interface
public interface IOrderState
{
DateTime PreparedOrder(DateTime orderDate);
DateTime DispatchOrder(DateTime preparedDate);
DateTime Delivered(DateTime dispatchDate);

}
public interface IOrderState
{
DateTime PreparedOrder(DateTime orderDate);
DateTime DispatchOrder(DateTime preparedDate);
DateTime Delivered(DateTime dispatchDate);

}
87 replies
CC#
Created by N0b0dy on 8/20/2022 in #help
[Help] understanding Architecture of a parcel system
sounds good to me, thanks sun warriors @aes @Angius
87 replies