esther
esther
CC#
Created by esther on 5/22/2023 in #help
✅ Help Me:)
40 replies
CC#
Created by esther on 5/4/2023 in #help
❔ API Ms Graph Help
How to connect ms teams to my application to Get meetingAttendanceReport or get MeetingOnline participants, so everytime we join meeting using ms teams it will post in my application daily task?
3 replies
CC#
Created by esther on 11/2/2022 in #help
Error in AsNoTracking()
40 replies
CC#
Created by esther on 9/20/2022 in #help
Help) [Answered]
I have relation with table in different database. I searched it possible if we use 2 queries and you can map it in DTO manually. I already created different Model, Repository, IRepository etc. Now i'm getting confused how to add the relation between two in DTO, Any reference?
9 replies
CC#
Created by esther on 9/7/2022 in #help
Is this good enough?
7 replies
CC#
Created by esther on 9/5/2022 in #help
Can someone help me? I got this error
78 replies
CC#
Created by esther on 9/1/2022 in #help
Can someone help me i got this error? [Answered]
161 replies
CC#
Created by esther on 8/15/2022 in #help
How to migrate table?
I have database with table: Quote, so i tried to migrate new table Author on database using package manager console but there's an error: System.InvalidOperationException: 'Cannot use table 'Quote' for entity type 'Sample' since it is being used for entity type 'Author' and potentially other entity types, but there is no linking relationship. Add a foreign key to 'Sample' on the primary key properties and pointing to the primary key on another entity typed mapped to 'Quote'.' Here my Author.cs model:
namespace Entities.Models
{
public class Author : BaseEntity
{
[Sieve(CanFilter = true, CanSort = true)]
public string Name { get; set; }
[Sieve(CanFilter = true, CanSort = true)]
public string Email { get; set; }
public ICollection<Sample> Quote { get; set; } //relation table
}
}
namespace Entities.Models
{
public class Author : BaseEntity
{
[Sieve(CanFilter = true, CanSort = true)]
public string Name { get; set; }
[Sieve(CanFilter = true, CanSort = true)]
public string Email { get; set; }
public ICollection<Sample> Quote { get; set; } //relation table
}
}
Here my Sample.cs model:
namespace Entities.Models
{
[Table("Quote")]
public class Sample : BaseEntity
{
[Column("Quote")]
[Sieve(CanFilter = true, CanSort = true)]
public string Quote { get; set; }

[ForeignKey(nameof(Author))]
public Guid? AuthorId { get; set; }
public Author Author { get; set; }
}
}
namespace Entities.Models
{
[Table("Quote")]
public class Sample : BaseEntity
{
[Column("Quote")]
[Sieve(CanFilter = true, CanSort = true)]
public string Quote { get; set; }

[ForeignKey(nameof(Author))]
public Guid? AuthorId { get; set; }
public Author Author { get; set; }
}
}
and here RepositoryContext.cs:
namespace Entities
{
public class RepositoryContext : DbContext
{
public RepositoryContext(DbContextOptions options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfigurationsFromAssembly(typeof(RepositoryContext).Assembly);
}

public DbSet<Sample> Samples { get; set; }
public DbSet<Author> Author { get; set; }
}
}
namespace Entities
{
public class RepositoryContext : DbContext
{
public RepositoryContext(DbContextOptions options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfigurationsFromAssembly(typeof(RepositoryContext).Assembly);
}

public DbSet<Sample> Samples { get; set; }
public DbSet<Author> Author { get; set; }
}
}
5 replies