Posts by Leonel Sanches da Silva • 88,623 points
2,010 posts
-
1
votes1
answer35
viewsA: MVC Read Agility
I would like to know if the best practice is the one described in the first example or the second and if there is any limitation of the MVC in relation to view reading, because I have always worked…
asp.net-mvcanswered Leonel Sanches da Silva 88,623 -
1
votes1
answer360
viewsA: How to do Reverse Engineering via Entityframework using a Firebird data source in Visualstudio 2015?
Install Firebird ADO.NET Data Provider and DDEX, available here, with Visual Studio closed. Try repeating reverse engineering procedure right after. EDIT As per @Tobymosque’s tip, it may be…
-
0
votes1
answer196
viewsA: Objectdisposedexception
Apparently, the list was not materialized in the .ToList(), then we will have to be more assertive with the context to obtain a materialized list of fact: using(var objectContext =…
-
1
votes2
answers601
viewsA: How to use my already populated Firebird database for a web project in visual Studio 2015 using Entity framework?
This is the old way of working with the Entity Framework. The most current way uses only project file settings web.config and Nuget packages. The ADO.NET provider to Firebird and its respective…
entity-framework firebird connection visual-studio-2015 databaseanswered Leonel Sanches da Silva 88,623 -
3
votes1
answer617
viewsA: View with 2 model inside a Viewmodel
The message is quite clear: Templates can be used only with field access, Property access, single-Dimension array index, or single-Parameter custom indexer Expressions. I mean, you can only use…
-
9
votes3
answers280
viewsA: How to mount SELECT?
SELECT P.PROCODIGO, P.PRONOME, H.HISPRECO FROM PRODUTO P INNER JOIN HISTORICO H ON P.PROCODIGO = H.PROCODIGO WHERE H.HISDATA = (SELECT MAX(HISDATA) FROM HISTORICO WHERE PROCODIGO =…
-
2
votes2
answers547
viewsA: Create Bank Automatically with Code First
This only makes sense if you have one deploy system by company. Therefore, it would have a company base by system. If the idea is to serve a single system to several companies, your idea just…
-
0
votes1
answer647
viewsA: Relative Path with virtual subdirectory
There is no problem with your code. It is just a question of the logic involved: var pasta = HttpContext.Current.Server.MapPath(String.Format("{0}\\{1}{2}\\{3}", "Cliente",…
-
2
votes1
answer123
viewsA: Ajax - Protect Webservices
Implementing the following attribute: public class PermitirCrossSiteJsonAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) {…
-
3
votes2
answers411
viewsA: Fluent API and Migration
1º - Use Migration to create the base, but in my test it generates the person table with all attributes and classes that extend Person only with the Idpessoa and the particular property of each one.…
-
5
votes2
answers704
viewsA: Entity - Disable Lazy Loading?
It is advisable to keep the Lazy load activated? Yes. It is not right to necessarily associate lazy load with performance loss. The lazy load exists to make development agile and uncomplicated. You…
-
2
votes1
answer221
viewsA: Linq - Searching for objects that have a predetermined list
You need to have mapped the association between Students and Subjects in your context: public DbSet<AlunoMateria> AlunosMaterias { get; set; } The sentence would be so: var idsDasMaterias =…
-
4
votes1
answer169
viewsA: Automate DDD
Yes, using the Mvcscaffolding.VS2015. You’ll have to write your own Scaffolder. See here how. If you want something more inside Visual Studio, can create your Scaffold using the Sidewaffle.…
-
6
votes1
answer166
viewsA: Edit MVC . NET error
If Fisica drift Pessoa, It’s not right here: @model CodeFirst.Models.Fisica <div> @Html.EditorFor(model => Model.Fisica) </div> Use @Html.Partial instead of @Html.Editor: @model…
-
1
votes1
answer30
viewsA: Problem to query inside the second Dropdown
It’s not gonna work here: public JsonResult GetVigarariasByDioceses(int DioceseId) { // Obter Vigararias de uma Diocese utilizando LINQ. var vigararias = db.Vigararia .Where(v => v.DioceseID ==…
-
9
votes2
answers289
viewsA: New C# 6 functionality "Auto-Property initializers" is just a facilitator?
The aim is only to facilitate the writing of the class, such as no longer needing to declare a constructor to perform the initializations, or behind something else? Actually no longer need to…
-
2
votes2
answers301
viewsA: Xmltextreader() identify end of node and duplicate tags
This is the hard way to deserialize an XML of products. It can be done as follows: [XmlRoot("produtos")] public class ListaProdutos { [XmlElement("produto")] public List<Produto> Produtos {…
-
2
votes1
answer266
viewsA: Select inside a dropdown using jquery
Apparently everything is ok. Use @Url.Action to mount jQuery addresses: $.getJSON("@Url.Action("GetDioceses", "MeuController")", function (data) { ... }…
-
12
votes1
answer3531
viewsA: How to change the Namespace of a C#project
I do it this way: Ctrl + Shift + H; Search expression (Find what): "using Windows;", or "namespace Windows" Replace with (Replace with): "using Novonomedenamespace;" (attention to keeping the…
-
7
votes1
answer379
viewsA: Pagination with generic method
No need to reinvent the wheel. Just install this package. Use: var pagina = 1; var registros = 50; var selecao = db.Entidade.ToPagedList(pagina, registros); Or else: var selecao = await…
-
1
votes1
answer363
viewsA: How to re-create table in sql by Entityframework
This is not the correct way to perform this procedure. The correct way would be to reverse the migration using the command: Update-Database -TargetMigration:NomeDeUmaMigracaoAnteriorSemOPontoCS If…
entity-framework-6answered Leonel Sanches da Silva 88,623 -
3
votes1
answer402
viewsA: Update One to Many Entity Framework
I use the following algorithm: private async Task AtualizarTelefones(Artista artista) { // Telefones Originais var telefonesOriginais = db.ArtistaTelefones.AsNoTracking().Where(at => at.ArtistaId…
-
12
votes2
answers1166
viewsA: Is it acceptable to use <H2>, <H3>, <p>, <div> tags within links/anchors (<a></a>)?
It is acceptable to use tags <h2>, <h3>, <p>, <div> within links/anchors (<a></a>)? Yes. This is an HTML5 feature. Other versions did not allow this use. On the…
-
7
votes1
answer187
viewsA: What are the PEP’s in Python?
PEP’s (Python Enhancement Proposals, or Proposals for Python Improvements). It works in a very similar way to IEEE RFC (english): some user interested in an improvement or new functionality detailed…
pythonanswered Leonel Sanches da Silva 88,623 -
1
votes2
answers286
viewsA: Is it possible to send Ienumerable typed view data to the Controller?
Install the package Decimalmodelbinder. In Global.asax.cs, method Application_Start, add the following: ModelBinders.Binders.Add(typeof(decimal), new DecimalModelBinder());…
asp.net-mvcanswered Leonel Sanches da Silva 88,623 -
2
votes1
answer931
viewsA: How to configure routes when the application is not at the root of the Asp.net mvc server?
To make your application work in a subdirectory, change your Web.config to the following: <?xml version="1.0" encoding="utf-8"?> <!-- For more information on how to configure your ASP.NET…
asp.net-mvcanswered Leonel Sanches da Silva 88,623 -
1
votes1
answer1170
viewsA: "arithmetic Exception, Numeric overflow, or string truncation string right truncation" in search using LINQ
The most elegant way to solve is by decorating attributes. Dispenses up to the Fluent API that you’re using: public class Cidade { public Cidade() { Codigo = null; Descricao = string.Empty; UF =…
-
1
votes1
answer61
viewsA: CSS positioning in _Layout.cshtml
To my knowledge, to function, the <table> must be at least within a <div class="row"> and then inside a <div> configure the responsiveness. For example: <div class="row">…
asp.net-mvcanswered Leonel Sanches da Silva 88,623 -
0
votes1
answer756
viewsA: Load updated page using method get jquery mvc Asp.net
There is a a package called Jqwidgets which has a non-commercial license of use, and whose grid has automatic update. Or you can make your manual mechanism, which is not very productive.…
-
1
votes1
answer1175
viewsA: How to take the value of a Dropdownlist to choose the action to be executed
In short, jQuery, Ajax and Partials. Explaining more, idTipoServico should be monitored by jQuery. Something like this: $(document).on("change", "#idTipoServico", function() { switch ($(this).val())…
-
2
votes1
answer224
viewsA: Upload in batch Asp.net MVC5
The user should be able to send attachments in their messages and download attachments in other messages. Use for this the Backload. It works with most JS multiple upload plugins available. He’s got…
-
4
votes1
answer62
viewsA: List names in a query and send to a Viewmodel
Your approach is not correct. The right one would be: var queryNomeCatequizandos = (from g in db.Grupo join i in db.Inscricao on g.GrupoID equals i.GrupoID join c in db.Catequizando on…
-
6
votes1
answer325
viewsA: Run Insert in Migrations Entity Framework
Yes, use the method Seed generated in Migrations\Configuratiom.cs: protected override void Seed(MeuProjeto.Models.ApplicationDbContext context) { // This method will be called after migrating to the…
-
5
votes2
answers627
viewsA: How to save an attribute to image
In an ASP.NET MVC system, what you’re looking for is the classic upload files. I will explain to a file only, and this scheme does not only serve for photos, but serves as a start. First, you will…
-
0
votes1
answer64
viewsA: Doubt in the publication of site done in Asp.net mvc
Add the following to your web.config and publish again: <configuration> ... <system.web> ... <customErrors mode="Off" /> <system.web> ... </configuration> The actual…
asp.net-mvcanswered Leonel Sanches da Silva 88,623 -
1
votes1
answer528
viewsA: datatables format field
For dates, I would use the Moment js.: var fullDate = moment(row[4].toString()).format('YYYY-MM-DD hh:mm:ss'); For money, the Numeral.js: var grana = numeral(45,4400).format('0.0')…
answered Leonel Sanches da Silva 88,623 -
2
votes1
answer194
viewsA: How to insert entity with ID into Entity Framework
Decorate the Id of Area with the following: [DatabaseGenerated(DatabaseGeneratedOption.None)] public int Id { get; set; } Instead of using: _contexto.Entry(area).State = EntityState.Added; Prefer:…
-
19
votes2
answers440
viewsA: What does # mean in the name of some languages?
In music, C is the ciphertext notation of the note or chord C. C# would be half tone up (C sharp). Another proof of this is the cover of Deitel on C#, with the ants and the piano. Similarly, F#…
-
3
votes1
answer2169
viewsA: Best practices when filtering a query with Entityframework
This is the correct way to create a search engine through filters? It is. In fact it takes an explanation for the understanding of error. When you mount a query in two different places through the…
-
2
votes1
answer42
viewsA: Doubt with version of Aspnet.Mvc
Not. Just make sure your project is exactly in this version of framework, right-clicking on the project and selecting the option Properties. If you are in version 4.5 of framework and the build does…
asp.net-mvcanswered Leonel Sanches da Silva 88,623 -
3
votes1
answer855
viewsA: Location and maps
There is the Google Maps API performing latitude and longitude search from an address provided as a source of search. Example: <script> geocoder = new google.maps.Geocoder(); function…
-
0
votes3
answers1002
viewsA: Namespace Serialization with link
This what you are trying to do is not only incorrect as is out of standard. If there is xmlns defined in the parent element, all children automatically belong to namespace. The exception occurs when…
-
2
votes1
answer19
viewsA: DB table not accessible
Possibly missing map the DbSet in the context: public DbSet<FluxoUsuario> FluxosUsuario { get; set; } Search use names of DbSet plural to differentiate the DbSet of the class of Model:…
-
0
votes2
answers97
viewsA: Tag HTML in Helper Razor
According to this answer from Darin Dmitrov, implement the following extension (modified to reflect your scenario): namespace MeuProjeto.Extensions { public static class HtmlHelperExtensions {…
-
2
votes1
answer337
viewsA: wkHtmlToPdf - Header and footer on all pages
I don’t think that Url.Action be the best option for header and footer. Instead, I would implement the following static method: public static string RenderPartialViewToString(Controller controller,…
-
1
votes1
answer68
viewsA: Linq XML problems using namespace . net
Removing the variable nS from here: xDoc.Add(New XElement(nS + "TLote_GNRE", xGuias)) I think it was confusing the way you used it. The right thing would be to use it like this: Dim raiz As XElement…
-
3
votes1
answer277
viewsA: Frameworks for use of Masks in ASP.NET MVC
In the case of fields with masks (CNPJ for example) and/or date, which ui free framework would be most recommended? You can use the jQuery.Maskedinput, which can be used in conjunction with any of…
-
2
votes1
answer1637
viewsA: User and password validation in Pop Up Modal using MVC 5
Modify your method to the following: [HttpPost] public JsonResult Autentica(string login_username, string login_password) { TSF_USUARIOS usuario = usuarioDAo.BuscaPorLoginSenha(login_username,…
-
3
votes1
answer77
viewsA: I can’t save a Dictionary
Try not to be sad with what I say: the Entity Framework does not map dictionaries. Create an associative class like this: public class FluxoUsuario { [Key] public int FluxoUsuarioID { get; set; }…
-
0
votes1
answer118
viewsA: Rename column with Entity framework
At your command verbose, we have: set @columnType := (select case lower(IS_NULLABLE) when 'no' then CONCAT(column_type, ' not null ') when 'yes' then column_type end from information_schema.columns…