Skip to content

Instantly share code, notes, and snippets.

View kleberksms's full-sized avatar

Kleber Syd Moraes da Silva kleberksms

View GitHub Profile
@kleberksms
kleberksms / example.cs
Created March 28, 2016 12:26
example.cs
public IHttpActionResult GetWithControllerRedirect(string system, string rcontroller)
{
try
{
string url = $"http://localhost:55164/api/{rcontroller}";
var request = (HttpWebRequest)WebRequest.Create(string.Format(url));
request.Method = "GET";
request.ContentType = "application/json; charset=utf-8";
request.Accept = "application/json; charset=utf-8";
var response = (HttpWebResponse)request.GetResponse();
var list = new List<Example>{
new Example{
Id = 1,
Description = "First Level",
Type = 4,
ParentId = 0
},
new Example{
Id = 2,
{
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
public void Configuration(IAppBuilder app)
{
var config = new HttpConfiguration();
app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions());
WebApiConfig.ConfigureWebApi(config);
app.UseCors(CorsOptions.AllowAll);
var kernel = new Func<StandardKernel>(new Container().CreateKernel);
@kleberksms
kleberksms / Exception
Created July 29, 2016 23:18
Exception
System.Reflection.TargetInvocationException: Uma exceção foi acionada pelo destino de uma chamada. ---> System.Net.WebException: A conexão subjacente estava fechada: Erro inesperado em um recebimento. ---> System.IO.IOException: Não é possível ler os dados da conexão de transporte: Foi forçado o cancelamento de uma conexão existente pelo host remoto. ---> System.Net.Sockets.SocketException: Foi forçado o cancelamento de uma conexão existente pelo host remoto
em System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- Fim do rastreamento de pilha de exceções internas ---
em System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
em System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
em System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
--- Fim do rastreamento de pilha de exceções internas ---
em System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest requ
//Models
public class Comarca
{
public Comarca(){}
public Comarca(string descricao, Guid ufId)
{
Id = Guid.NewGuid();
Descricao = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(descricao);
public class MyContext : DbContext
{
public MyContext(DbContextOptions<MyContext> options) :base(options)
{ }
public DbSet<Obj1> Obj1s { get; set; }
}
{System.ObjectDisposedException: Cannot access a disposed object. A common cause of this error is disposing a context that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application. This may occur if you are calling Dispose() on the context, or wrapping the context in a using statement. If you are using dependency injection, you should let the dependency injection container take care of disposing context instances.
Object name: 'SistemaJuridicoContext'.
at Microsoft.EntityFrameworkCore.DbContext.get_InternalServiceProvider()
at Microsoft.EntityFrameworkCore.DbContext.get_ChangeTracker()
at Microsoft.EntityFrameworkCore.Query.CompiledQueryCacheKeyGenerator.GenerateCacheKeyCore(Expression query, Boolean async)
at Microsoft.EntityFrameworkCore.Query.Internal.RelationalCompiledQueryCacheKeyGenerator.GenerateCacheKeyCore(Expression query, Boolean async)
at Microsoft.EntityFrameworkCore.Query.Internal.RelationalCompiledQueryCacheKeyGen
{
"description": "Crm Gateway Shared Kernel",
"authors": [ "bp" ],
"packOptions": {},
"frameworks": {
"netcoreapp1.1": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
jQuery(function ($) {
$(document).ready(function () {
$('.modal-loading').show();
//########## Manipulação HTML ##########
getUf();
getBancos();
getAcao();
getPublicacao();