Skip to content

Add Table-Valued function support to EntityMapping.#147

Open
Freydoonk wants to merge 5 commits intoMoonStorm:masterfrom
Freydoonk:master
Open

Add Table-Valued function support to EntityMapping.#147
Freydoonk wants to merge 5 commits intoMoonStorm:masterfrom
Freydoonk:master

Conversation

@Freydoonk
Copy link

TableValuedFunction supporting was added.
To did this the EntityMapping class was converted to an abstract class. TableValuedFunctionEntityMapping and EntityMapping which inherited the abstract EntityMapping were added.

SetDatabseName was addedd to EntityMapping configuration options.
A new facility was added to specify a Database name to each entity while doing configuration.

@MoonStorm
Copy link
Owner

Thanks for sharing your work. I'm gonna try to find some time to review it. I have a couple of ideas myself to refactor the JOINs. We'll see what comes out.

Copy link

@iamteamstar iamteamstar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one commit, a lot of change. few files, not healtly

/// </summary>
[Table("CrazyColumns")]
public partial class CrazyColumn
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please dont attribute in entity class. you can configuration class for this constraints. for examle
public void Configure(EntityTypeBuilder builder)
{
builder.ToTable("Students");

	builder.HasKey(x => x.ID);

	builder.Property(x => x.Name)
		   .IsRequired()
		   .HasMaxLength(50);

	builder.Property(x => x.Email)
		   .IsRequired()
		   .HasMaxLength(100);

	builder.HasCheckConstraint("CK_Student_Email", "[Email] LIKE '%@%.%'");

	builder.Property(x => x.TCNo)
		   .IsRequired()
		   .HasMaxLength(11)
		   .IsFixedLength();

	builder.HasCheckConstraint("CK_Student_TCNo", "LEN([TCNo]) = 11 AND [TCNo] NOT LIKE '%[^0-9]%'");

	builder.HasIndex(x => x.Email).IsUnique();
}

(you need implemet IEntityTypeConfiguration interface)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants