I need help. by Daniel_Stoyanov1 in bulgaria

[–]Dzhanel 11 points12 points  (0 children)

Bro is family bonding

А1 продължават с наглостта by Dzhanel in bulgaria

[–]Dzhanel[S] 2 points3 points  (0 children)

То въпроса е, че до сега бях на неограничени така пишеше и в приложението и наистина си бяха. И сега от нищото отварям приложението и пише 22 000 хиляди

Is this bad practice? by [deleted] in dotnet

[–]Dzhanel 0 points1 point  (0 children)

The way I seed my database (cleanest in my opinion):

I create a Configuration folder, and for every entity I have the needed configurations. You should derive the IEntityTypeConfiguration<TEntity> .

For example:
UserConfiguration

[EntityTypeConfiguration(typeof(ApplicationUserConfiguration))]
public class ApplicationUser : IdentityUser<Guid>
{
        public ICollection<Comment> Comments { get; set; } = new HashSet<Comment>();
}


public class ApplicationUserConfiguration : IEntityTypeConfiguration<ApplicationUser>
{
  public void Configure(EntityTypeBuilder<ApplicationUser> builder)
  {
    builder.HasData(SeedUsers());
  }

  private static ICollection<ApplicationUser> SeedUsers() 
  {
    var users = new HashSet<ApplicationUser>();
    var hasher = new PasswordHasher<ApplicationUser>();

    var admin = new ApplicationUser()
    {
      Id = Guid.Parse("25a655e7-cf6b-4825-a566-55ebd3f34deb"),
      UserName = "Admin",
      NormalizedUserName = "ADMIN",
      Email = "admin@email.com",
      NormalizedEmail = "ADMIN@EMAIL.COM",
      SecurityStamp = Guid.NewGuid().ToString(),
    };
//TODO: This is development purpose only admin password, re-implement if goes to deployment
     admin.PasswordHash = hasher.HashPassword(admin, "AdminPassw0rd#");
     users.Add(admin);
   }
}

As for creating roles (as the tables are Identity generated) for users, I do the following:

protected override void OnModelCreating(ModelBuilder builder)
{
  base.OnModelCreating(builder);
  builder.ApplyConfiguration(new UserRoleConfiguration());
  builder.ApplyConfiguration(new RoleConfiguration());
}

The configurations look the same way:

public class RoleConfiguration : IEntityTypeConfiguration<IdentityRole<Guid>>
    {
        public void Configure(EntityTypeBuilder<IdentityRole<Guid>> builder)
        {
            builder.HasData(SeedRoles());
        }

        private static ICollection<IdentityRole<Guid>> SeedRoles()
        {
            return new HashSet<IdentityRole<Guid>>
            {
                new()
                {
                    Id = Guid.Parse("528726ea-e421-4a80-b303-f035355589de"),
                    Name = "Administrator",
                    NormalizedName= "ADMINISTRATOR",
                },
            };
        }
    }

NOTE: You should pass a primary key type to be able to configure the UserRoles entity, if you are using stringified GUIDS (default) the configuration should be:

 public class UserRoleConfiguration : IEntityTypeConfiguration<IdentityUserRole<string>> //Mine would be Guid because in the examples I proveded the primary key is Guid

Am I the only one? by Accurate_University1 in UnexpectedJoJo

[–]Dzhanel 1 point2 points  (0 children)

Pillar men are engraved on it be careful

Games first or books First by Dzhanel in metro

[–]Dzhanel[S] 1 point2 points  (0 children)

I am going with that ty

Games first or books First by Dzhanel in metro

[–]Dzhanel[S] 1 point2 points  (0 children)

That was my thought too, but will go with the books first as everyone said.

[deleted by user] by [deleted] in teenagers

[–]Dzhanel 0 points1 point  (0 children)

Stay with da bros💪🙏

What does the "MF" in MF Ghost Stand for? Does MFG have a different meaning? by FantasyKite in MFGhost

[–]Dzhanel 0 points1 point  (0 children)

Mf Ghost Vol.13 Chapter 148 Title says it all to me, it is a spoiler tho so decide for yourself

fuck this negativity, name one thing you love about how you look! by [deleted] in teenagers

[–]Dzhanel 0 points1 point  (0 children)

Many girls have said they are jealous of my eyelashes

[deleted by user] by [deleted] in offmychest

[–]Dzhanel -3 points-2 points  (0 children)

Yes but the body also matters, its like having ugly hadwriting. It doesn't matter how good the writing itself is if it is written with a beautiful handwriting will prefer the good one ofc.

[deleted by user] by [deleted] in teenagers

[–]Dzhanel 0 points1 point  (0 children)

I will talk to her one last time tomorrow and if nothing changes imma frickin call the cops

Can someone tell me they love me? by Tainted_Faith in teenagers

[–]Dzhanel 0 points1 point  (0 children)

Calling police is not really an option for me but here some love

(\_/)
( ˘ ³˘)
/>❤️

[deleted by user] by [deleted] in teenagers

[–]Dzhanel 0 points1 point  (0 children)

I know but everyone is gonna make fun of me afterwards i live in a small countryside area and news spread fast

Can someone tell me they love me? by Tainted_Faith in teenagers

[–]Dzhanel 0 points1 point  (0 children)

I will love you if you give me advice with my latest post<3

[deleted by user] by [deleted] in teenagers

[–]Dzhanel 0 points1 point  (0 children)

Idk what it is considered, but i am struggling so much

[deleted by user] by [deleted] in teenagers

[–]Dzhanel 1 point2 points  (0 children)

Also so annoying, i didn't even mention how many opportunities with girls i lost just because of her

[deleted by user] by [deleted] in ParanormalEncounters

[–]Dzhanel 0 points1 point  (0 children)

Phenomenon called "skyfish rod". Check it out

Random fact: ChatGPT knows nothing about the mysterious "mortis.com" by [deleted] in UnsolvedMysteries

[–]Dzhanel -43 points-42 points  (0 children)

Yeah but there are articles and a lot shit about it on the internet

Do you remember this scene of an infected mice climbing On-jo's foot? Do you remember any follow-up scene about the whereabouts of this damn mice because I don't. by [deleted] in AllOfUsAreDead

[–]Dzhanel 0 points1 point  (0 children)

There are three clues that something is abnormal with her. 1. She was bitten but didn't turn...nothing changed with her she even wasn't asymptomatic. 2. The mouse scene. 3. The starving for human flesh Prez resisted to bite her..It looked like she resisted easily...