0
mdframe created
ASP.NET Core + Angular v6.5.0
We need some insight. We recently added two fields to an existing database and entity. The database does not have any spaces for these fields stored in their columns however when we perform the GetXXXForEdit function the field immediately has been max filled with the length. The MinLength is set to 0 and Max is 15. Here are the code snippets:
[AbpAuthorize(AppPermissions.Pages_ProductLocations_Edit)]
public async Task<GetProductLocationForEditOutput> GetProductLocationForEdit(EntityDto<long> input)
{
var productLocation = await _productLocationRepository.FirstOrDefaultAsync(input.Id); <-- Field Filled with spaces here
var output = new GetProductLocationForEditOutput {ProductLocation = ObjectMapper.Map<CreateOrEditProductLocationDto>(productLocation)};
[Table("ProductLocations")]
public class ProductLocation : FullAuditedEntity<long> , IMustHaveTenant
...
... Other Entity Fields...
...
[StringLength(ProductLocationConsts.MaxIMEILength, MinimumLength = ProductLocationConsts.MinIMEILength)]
public string IMEI { get; set; }
public const int MinIMEILength = 0;
public const int MaxIMEILength = 15;
What are we missing or done incorrectly in this situation?
Thx
5 Answer(s)
-
0
Hi @mdframe
- Is the _productLocationRepository a generic repository ?
- Are you using SQL Server or any other DB server ?
-
0
Hi @ismcagdas,
The db is SQL Server and the only connection for this repository is ProductLocation table.
Thx
-
0
Hi @mdframe
Could you share what is the datatype for your IMEI column in the database ? Is it nvarchar or varchar ?
Thanks,
-
0
@ismcagdas,
Sorry about that, here is the column information:
[IMEI] [nvarchar](15) NOT NULL,
-
0