public class UserEntity
{
[Column(DatabaseStructure.FieldUserIdUser)]
public int IdUser { get; set; }
[Column(DatabaseStructure.FieldUserCsIdUser)]
public string CsIdUser { get; set; }
[Column(DatabaseStructure.FieldUserIdRole)]
public int IdRole { get; set; }
}
I’ve also tried to reproduce the problem with the following snippet but without any luck
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace Test
{
public class S2259
{
public void Test(IUserStoreDao _userStoreDao)
{
var userEntity = GetUsers();
foreach (var storeCode in new List<string> { "" })
{
var storeId = _userStoreDao.GetStoreId(storeCode);
if (storeId > 0 && userEntity != null && userEntity.Count > 0)
{
_userStoreDao.InsertUserStore(userEntity.FirstOrDefault().IdUser, storeId);
continue;
}
_userStoreDao.InsertPendingUserStore(1, "email", storeCode);
}
}
private List<UserEntity> GetUsers() => new List<UserEntity>();
}
public interface IUserStoreDao
{
int GetStoreId(string code);
void InsertUserStore(int userId, int storeId);
void InsertPendingUserStore(int id, string email, string storeCode);
}
public class UserEntity
{
[Column("FieldUserIdUser")]
public int IdUser { get; set; }
[Column("FieldUserCsIdUser")]
public string CsIdUser { get; set; }
[Column("FieldUserIdRole")]
public int IdRole { get; set; }
}
}
Do you think it’s possible to create a small test project which reproduces the false positive and attach it to this thread?