No such entity with customerId

I get this error when trying to register an account :

No such entity with customerId = 13818

I think it might be some old custom attribute that is the root of the problem.

How can I clean the customer_eav_table and customer_eav_website tables from all custom attributes ? I would like to clean everything up.

Magento 2.2.6

Passing entity constructor to a player

I created an entity class with its constructor:

class Entity { public:     Entity(sf::Vector2f Size, sf::Vector2f Position, std::string File_name, int Damage, int Life, float Speed);     int Entity_damage, Entity_life, Counter = 0, Direction = 2;     float Entity_movement_speed;     std::shared_ptr< sf::Texture > Entity_texture;     sf::Vector2f Map_margin;     sf::RectangleShape Entity_rect;   }; 

The Constructor:

Entity::Entity(sf::Vector2f Size, sf::Vector2f Position, std::string File_name, int Damage, int Life, float Speed) {     Entity_rect.setSize(Size);     Entity_rect.setPosition(Position);     Entity_texture = Shared_resources::Acquire(File_name);     Entity_rect.setTexture(&*Entity_texture);     Entity_damage = Damage;     Entity_life = Life;     Entity_movement_speed = Speed; } 

and now I have a player class which inheritances from entity, but i don’t know how to access entity constructor.

How do you management shared information and private information of an entity?

Let’s say we are going to design a system to manage configuration of a lot of virtual machines (VM). All VMs have the same configuration space. And for a specific configuration item, different VM can have different value. All VM2 can be divided into several groups according to their usage. For one group, all the VMs in this group share most configuration value, but they may also have some configuration item with different value. How to design the system with the following considerations: 1. should be easy to add a VM to inherit the shared configuration value of a group; 2. should be easy to manage a VM’s private configuration value; 3. when changed the shared configuration value of a group, the VMs inherited this configuration value will also update their value;

Any ideas on how to achieve this?

No such entity with customerId = someid

I am having this error in logs every time a customer is registered after placing new order in Magento 2.3.2

report.CRITICAL: No such entity with customerId = "someid"{"exception":"[object] (Magento\Framework\Exception\NoSuchEntityException(code: 0): No such entity with customerId = "someid" at /mydir/magento/framework/Exception/NoSuchEntityException.php:50)"} [] 

This error wasn’t there and created after update from version 2.3.1 to 2.3.2

Any help please?

DDD and CQRS – Define an entity for Scheduling use case

I have a use case of scheduling a person to some work for some time range. Eg. A service for assigning a person A to work for time range X to Z in location C.

The only constraint it has, is one person cannot work on 2 things at same time. Eg. if person A is assigned to work in time 2019-07-21 to 2010-07-25, then person A cannot be assigned to any other work in that time. Eg. Person A for time range 2019-07-23 to 2019-07-27 should not be possible.

I am trying to make a service for it using domain driven design which would assign a person to some work. The entity I thought would be something like:

class Assignment {     PersonId,     startTime,     endTime,     location } 

Now, I wanted to make sure that if I found a entry in my database for Person A in some time range, then the call to create an entry for Person A in time range that is overlapping with the existing ones should fail.

Since, I am using CQRS model with DDD, so I don’t want to make a query to my database asking for all the assignments for that person. This may not always be recent data because of eventual consistency in CQRS model. I know in my primary key, PersonId would be there but I am not sure how can I use start and end time in it.

Any suggestions what I can do to achieve my goal for this? Is doing DDD and CQRS not a good idea in this? Or there is a better way to model this entity so that I can achieve my goal.

Fastest way to look up an entity with a set of components?

I’m currently trying to implement an ECS system, but I’ve sort of ran into a problem trying to fetch all of my entities that have a specific set of components. I currently have a Dictionary that maps a component name to a list of Guids (entities), so I have no problem fetching a list of entities if I were to query for just one component. But if I were to query entities for more than one component (e.g. all entities that have Render and Transform component), I run into a problem where it’s no longer a constant time lookup.

I could probably loop through the entities to see if they contain that set of component names (they are stored in a dictionary that maps Guid to a list of strings), but I was thinking that there could be a faster way of doing this?

Atualizar campo de saldo, com C# e Entity Framework

Tenho uma dúvida bastante simples, porém não encontrei como resolvê-la no EF.

Preciso reescrever uma SP que hoje roda no SQL, que faz atualização do saldos de contas.

“UPDATE SALDOS SET CREDITO = CREDITO + 100”

Dessa forma consigo garantir que o saldo será atualizado com o valor atual existente no banco de dados, somando o valor 100.

Como consigo reescrever essa linha, sem a necessidade de buscar previamente o saldo, para atualizar com o novo saldo?

Conseguiram entender minha dúvida?

How do I access a child entity field for reference in an MFTF Test

I need assistance trying to access a field of a required entity inside a parent entity created for a test

Example I am trying to create a configurable product

<createData entity="productAttributeWithTwoOptions" stepKey="createConfigProductAttributes"> 

The entity for that looks like this

<entity name="productAttributeWithTwoOptions" type="ProductAttribute">   <data key="attribute_code" unique="suffix">attribute</data>   <data key="frontend_input">select</data>   ...   <data key="used_for_sort_by">true</data>   <requiredEntity type="FrontendLabel">ProductAttributeFrontendLabel</requiredEntity> </entity> 

In the test how could I access the label field from the FrontendLabel required entity?

<entity name="ProductAttributeFrontendLabel" type="FrontendLabel">   <data key="store_id">0</data>   <data key="label" unique="suffix">attribute</data> </entity> 

I assumed it might be something like this {{createConfigProductAttributes.ProductAttributeFrontendLabel.label}}

Update Entity for Repository Pattern and UOW Pattern C#

In one mock solution, I have created 3 mock projects to implement layered architecture design mainly the – Presentation Layer (Web) – Domain Model Layer – Infrastructure Layer. I haven’t yet to add Application Service Layer (Web API).

For simplicity, I have only two domain model entities: Customer.cs and Category.cs. In my domain model layer, I also put my repository interface (both custom and generic).

In Infrastructure layer, I have the dbcontext, Unit of Work (including its interface) and repository classes (which implement repository interface).

enter image description here

Here is my generic repository interface

public interface IRepositoryGeneric<TEntity> where TEntity : class {     // CRD     void Add(TEntity entity);     void Remove(TEntity entity);     TEntity Get(object Id);     IEnumerable<TEntity> GetAll();      void Save(); } 

Generic Repository class

public class RepositoryGeneric<T> : IRepositoryGeneric<T> where T : class {     protected readonly AppDbContext db;     public RepositoryGeneric(AppDbContext db)     {         this.db = db;     }      public void Add(T entity)     {         db.Set<T>().Add(entity);     }      public T Get(object Id)     {         return db.Set<T>().Find(Id);     }      public IEnumerable<T> GetAll()     {         return db.Set<T>().ToList();     }      public void Remove(T entity)     {         db.Set<T>().Remove(entity);      }      public void Save()     {         db.SaveChanges();     } } 

Unit of Work Interface

public interface IUnitOfWork : IDisposable {     IRepositoryCustomer Customers { get; }     IRepositoryCategory Categories { get; }      int Save(); } 

Unit of Work Class

public class UnitOfWork : IUnitOfWork {     private readonly AppDbContext db;     public UnitOfWork()     {         db = new AppDbContext();     }      private IRepositoryCustomer _Customers;     public IRepositoryCustomer Customers     {         get         {             if (this._Customers == null)             {                 this._Customers = new RepositoryCustomer(db);             }             return this._Customers;         }     }      private IRepositoryCategory _Categories;     public IRepositoryCategory Categories     {         get         {             if (_Categories == null)             {                 _Categories = new RepositoryCategory(db);             }             return _Categories;         }     }      public void Dispose()     {         db.Dispose();     }      public int Save()     {         return db.SaveChanges();     } } 

I learned that I should not have the update method in my generic repository interface. But without update method, I am now stuck at edit method in my presentation MVC web controller. Below, I extracted just the edit action method. The error is in that line in bold.

[HttpPost]     [ValidateAntiForgeryToken]     public ActionResult Edit([Bind(Include = "CategoryID,CategoryName,Description")] Category category)     {         if (ModelState.IsValid)         {             **db.Entry(category).State = EntityState.Modified;**             db.Save();             return RedirectToAction("Index");         }         return View(category);     } 

Lastly, are my classes created in the right layer? Example should IUnitOfWork.cs be in Infrastructure layer?

My whole solution source is available at my github – https://github.com/ngaisteve1/LayeredArchitectureDesignCSharp