Skip to content

Instantly share code, notes, and snippets.

View netdragoon's full-sized avatar

NetDragoon netdragoon

  • NetDragon
  • Brazil
View GitHub Profile
@netdragoon
netdragoon / ProductAndDetailsLinq.cs
Created November 8, 2017 13:54
ProductAndDetailsLinq.cs
Product p1 = db.Product.Include(x => x.Details)
.FirstOrDefault(x => x.Id == 1);
@netdragoon
netdragoon / ProductSQL.cs
Created November 8, 2017 13:51
ProductSQL.cs
SELECT TOP(1) [x].[Id], [x].[Description]
FROM [Products] AS [x]
WHERE [x].[Id] = 1
@netdragoon
netdragoon / ProductSimply.cs
Created November 8, 2017 13:49
ProductSimply.cs
Product p0 = db.Product.FirstOrDefault(x => x.Id == 1);
@netdragoon
netdragoon / ProductDetailsMap.cs
Created November 8, 2017 13:41
Product Details Map Table Spllit
public class ProductDetailsMap : IEntityTypeConfiguration<ProductDetails>
{
public void Configure(EntityTypeBuilder<ProductDetails> builder)
{
builder.ToTable("Products");
builder.HasKey(x => x.Id);
builder.Property(x => x.Amount)
.IsRequired();
@netdragoon
netdragoon / ProductMap.cs
Created November 8, 2017 13:40
Product Map Table Spllit
public class ProductMap : IEntityTypeConfiguration<Product>
{
public void Configure(EntityTypeBuilder<Product> builder)
{
builder.ToTable("Products");
builder.HasKey(x => x.Id);
builder.Property(x => x.Id)
.IsRequired()
.UseSqlServerIdentityColumn();
@netdragoon
netdragoon / ProductAndDetails.cs
Created November 8, 2017 13:38
Product e ProductDetails Table Split
public class Product
{
public int Id { get; set; }
public string Description { get; set; }
public ProductDetails Details { get; set; }
}
public class ProductDetails
{
public int Id { get; set; }
@netdragoon
netdragoon / Startup.cs
Created June 30, 2017 20:23 — forked from KerryRitter/Startup.cs
OpenIddict Startup Example (with postgres and custom password rules)
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace MyApp.Api
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using AspNet.Security.OpenIdConnect.Extensions;
using AspNet.Security.OpenIdConnect.Primitives;
using AspNet.Security.OpenIdConnect.Server;
using DreamInvest.Backend.Models;
using Microsoft.AspNetCore.Authorization;
@netdragoon
netdragoon / cnpj.js
Created April 28, 2017 16:13 — forked from phsacramento/cnpj.js
Extensão para Jquery.Validation Brasil pt-BR Observação: Adicione no final do arquivo jquery.validation.js
jQuery.validator.addMethod("cnpj", function (cnpj, element) {
cnpj = jQuery.trim(cnpj);
// DEIXA APENAS OS NÚMEROS
cnpj = cnpj.replace('/', '');
cnpj = cnpj.replace('.', '');
cnpj = cnpj.replace('.', '');
cnpj = cnpj.replace('-', '');
var numeros, digitos, soma, i, resultado, pos, tamanho, digitos_iguais;
/*
verifica_cpf_cnpj
Verifica se é CPF ou CNPJ
@see http://www.tutsup.com/
*/
function verifica_cpf_cnpj ( valor ) {
// Garante que o valor é uma string