BekirK
✅ How to set enum default int value
Its not just our desicion. Db admin suggest this to us. We dont want to do this really. Because there is a lot of work/effort/hours for this. because you should preserve the previous values of each enum according to their counterparts in the db. There are many things you need to pay attention to when going to the production environment, etc.
40 replies
✅ How to set enum default int value
It's actually not a bottleneck for us. But it is just a necessary step for optimization. Although it makes sense to keep the enum as a string in the db for reporting etc., the correct thing is to keep it numerical. So our team decided to choose this.
40 replies
OData filtering
Error Message: errors": ["The LINQ expression 'DbSet<User>()\r\n .Where(u => !(u.IsDeleted))\r\n .Where(u => DbSet<UserRole>()\r\n .Where(u0 => !(u0.IsDeleted))\r\n .Where(u0 => EF.Property<Guid?>(u, "Id") != null && object.Equals(\r\n objA: (object)EF.Property<Guid?>(u, "Id"), \r\n objB: (object)EF.Property<Guid?>(u0, "UserId")))\r\n .Any() ? string.Join(\r\n separator: ",", \r\n values: DbSet<UserRole>()\r\n .Where(u1 => !(u1.IsDeleted))\r\n .Where(u1 => EF.Property<Guid?>(u, "Id") != null && object.Equals(\r\n objA: (object)EF.Property<Guid?>(u, "Id"), \r\n objB: (object)EF.Property<Guid?>(u1, "UserId")))\r\n .Join(\r\n inner: DbSet<Role>()\r\n .Where(r => !(r.IsDeleted) && r.PropertyId == 00000000-0000-0000-0000-000000000000 || (Guid?)r.PropertyId == (Guid?)c8109bdf-1d8e-42c9-bc9d-be70fb1333bb), \r\n outerKeySelector: u1 => EF.Property<Guid?>(u1, "RoleId"), \r\n innerKeySelector: r => EF.Property<Guid?>(r, "Id"), \r\n resultSelector: (o, i) => new TransparentIdentifier<UserRole, Role>(\r\n Outer = o, \r\n Inner = i\r\n ))\r\n .Select(u1 => u1.Inner.Description)) : null == __TypedProperty_0)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information."]
3 replies
There are a lot of IF statements here
Nested if blocks can be removed. You can check two conditions with a single if. In the form of if (a && b), there is only one if condition in it, no separate situation is handled. The switch-case structure may be more suitable for such a situation.
You can even write a generic method to evaluate relevant conditions rather than repeating the same code. CheckIsNull(SmokeFix) etc.
22 replies