- 1.0.5 2026-03-18 Se comprueba el atributo MaxLength en ObtieneLongitudCampo en caso de que no se encuentre la propiedad
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
Imports System.Reflection
|
Imports System.ComponentModel.DataAnnotations
|
||||||
|
Imports System.Linq.Dynamic.Core
|
||||||
|
Imports System.Reflection
|
||||||
Imports System.Runtime.CompilerServices
|
Imports System.Runtime.CompilerServices
|
||||||
Imports Microsoft.EntityFrameworkCore
|
Imports Microsoft.EntityFrameworkCore
|
||||||
Imports Microsoft.EntityFrameworkCore.Internal
|
Imports Microsoft.EntityFrameworkCore.Internal
|
||||||
Imports System.Linq.Dynamic.Core
|
|
||||||
|
|
||||||
|
|
||||||
Namespace Extensiones
|
Namespace Extensiones
|
||||||
@@ -33,7 +34,21 @@ Namespace Extensiones
|
|||||||
If Tabla Is Nothing Then Throw New Exception("Tabla " & NombreTablaBase & " no encontrada")
|
If Tabla Is Nothing Then Throw New Exception("Tabla " & NombreTablaBase & " no encontrada")
|
||||||
Dim Campo = Tabla.FindProperty(NombreCampo)
|
Dim Campo = Tabla.FindProperty(NombreCampo)
|
||||||
If Campo Is Nothing Then
|
If Campo Is Nothing Then
|
||||||
Return -1 ' Throw New Exception("No existe el campo " & NombreCampo & " en la tabla " & NombreTablaBase)
|
Dim tipo = AppDomain.CurrentDomain.GetAssemblies().SelectMany(Function(a) a.GetTypes()).FirstOrDefault(Function(t) t.FullName = EspacioNombres & "." + NombreTablaBase)
|
||||||
|
|
||||||
|
If tipo IsNot Nothing Then
|
||||||
|
Dim propiedad = tipo.GetProperty(NombreCampo)
|
||||||
|
Dim maxLengthAttr = propiedad?.GetCustomAttribute(Of MaxLengthAttribute)()
|
||||||
|
|
||||||
|
If maxLengthAttr IsNot Nothing Then
|
||||||
|
Dim max As Integer = maxLengthAttr.Length
|
||||||
|
Return max
|
||||||
|
Else
|
||||||
|
Return -1
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Return -1
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
Dim LongitudCampo As Integer? = Campo.GetMaxLength()
|
Dim LongitudCampo As Integer? = Campo.GetMaxLength()
|
||||||
|
|
||||||
|
|||||||
@@ -11,11 +11,12 @@
|
|||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<PackageId>tsEFCore8</PackageId>
|
<PackageId>tsEFCore8</PackageId>
|
||||||
<PackageTags>net8.0, libreria</PackageTags>
|
<PackageTags>net8.0, libreria</PackageTags>
|
||||||
<Version>1.0.3</Version>
|
<Version>1.0.5</Version>
|
||||||
<Authors>Pedro</Authors>
|
<Authors>Pedro</Authors>
|
||||||
<Company>Tecnosis S.A</Company>
|
<Company>Tecnosis S.A</Company>
|
||||||
<Description>Utilidades Entity Framework compatibles con EF Core 8.</Description>
|
<Description>Utilidades Entity Framework compatibles con EF Core 8.</Description>
|
||||||
<PackageReleaseNotes>
|
<PackageReleaseNotes>
|
||||||
|
- 1.0.5 2026-03-18 Se comprueba el atributo MaxLength en ObtieneLongitudCampo en caso de que no se encuentre la propiedad
|
||||||
- Se agrega README.md
|
- Se agrega README.md
|
||||||
</PackageReleaseNotes>
|
</PackageReleaseNotes>
|
||||||
<PackageReadmeFile>README.md</PackageReadmeFile>
|
<PackageReadmeFile>README.md</PackageReadmeFile>
|
||||||
|
|||||||
Reference in New Issue
Block a user