Posts by Leonel Sanches da Silva • 88,623 points
2,010 posts
-
2
votes2
answers90
viewsA: Extra information on a user login
I also thought about using Session, but I think there is a more appropriate technology. It exists. It is the technology of Profiles. Use your own implementation of ProfileBase to save each user’s…
-
2
votes1
answer321
viewsA: Fluent Mapping or Data Annotations?
Which of the two is best recommended? Fluent Mapping or Data Annotations? There is no "best recommended" here. They are complementary, having several functions in common. Each is used according to…
-
1
votes1
answer2863
viewsA: Function $(Document). ready() only executes once
I don’t know if that’s the case, but JS inside Partial usually doesn’t run. Another thing that influences is that you have not specified in which layout block this JS will be loaded. The correct is…
-
4
votes5
answers42558
viewsA: How to delete data from a table with dependencies in other tables
Disabling and Enabling foreign key constraints. The commands are as follows:: For SQL Server: -- Desabilita todas as constraints de uma tabela ALTER TABLE MinhaTabela NOCHECK CONSTRAINT ALL --…
-
1
votes2
answers3308
viewsA: Project C in Visual Studio
Yes, but you’ll have to use a C++ project to write in C: This site gives a few more details on how to use a pure C structure.…
-
1
votes2
answers1135
viewsA: How to publish a project in ASP.NET MVC at a specific URL
Using areas. There’s this tutorial from Microsoft and some others over the internet. It is not worth putting a step by step response because of the size.…
-
1
votes2
answers179
viewsA: Authorize has stopped working
Just formalizing a response: Check the method AddUsersToRoles of your RoleProvider. Apparently it’s a bug in its implementation.
asp.net-mvcanswered Leonel Sanches da Silva 88,623 -
2
votes1
answer96
viewsA: Persist data in Profilecommon
You have to recreate the profile object every time you upload information from your user. Therefore, here: ProfileCommon profile = Profile.GetProfile(Login.Text); In the GetProfile you have to…
-
1
votes2
answers628
viewsA: How to lock on to TFS?
Almost that. The option name is Check Out for Edit...: In the Lock Type, choose the option Chec In - Allow other users to check out but Prevent them from checking in:…
team-foundation-serveranswered Leonel Sanches da Silva 88,623 -
3
votes1
answer394
viewsA: Code First Table Migration - N to N using Fluent API
Yes. There is a slightly different alternative syntax: modelBuilder.Entity<Aluno>() .HasMany(u => u.Turmas) .WithMany() .Map(m => { m.MapLeftKey("Turma_TurmaID");…
-
1
votes3
answers222
viewsA: Removing characters from a string - Python
I think it would be the case to use a regular expression: import re p = re.compile("Address:([\d\.]*)") match = p.match(sua_string) resultado = match.group()…
-
2
votes1
answer114
viewsA: User property, utility and possible Displays
What is the User property of the Asp.Net Mvc Controller and, is the same thing as a Webform? What is the purpose of it? User is an interface object IPrincipal. An object Principal is intended to…
-
1
votes1
answer322
viewsA: Access to DAL data with ASP.Net MVC Identity and Owin
First, ASP.NET Identity and OWIN are not "separable". OWIN is a standard interface, and ASP.NET Identity is an implementation that deals with users in your application. ASP.NET Identity may or may…
-
1
votes1
answer781
viewsA: How to fill a textbox with a Mysql LIKE?
The way suggested by Microsoft advises you to install the ASP.NET Ajax Control Toolkit, although it is possible (with greater difficulty) to use jQuery UI and create your own AJAX requests. By way…
-
1
votes4
answers3027
viewsA: Loading the values of a select in my Gridview
We had to activate the AutoGenerateColumns, probably. protected void Page_Load(object sender, EventArgs e) { GrdVeiculo.AutoGenerateColumns = true; GrdVeiculo.DataSource =…
-
1
votes1
answer814
viewsA: Calling methods in controller class (Asp.net web.api) to work when changing parameter name
Basically, the route to. Usually, it is configured like this: GlobalConfiguration.Configuration.Routes.MapHttpRoute( name: "DefaultApi", routeTemplate: "api/{controller}/{action}/{id}", defaults:…
-
2
votes1
answer129
viewsA: Problems connecting Mysql with Asp.net c#
Permission is missing, no matter how root the user is: Perform the following: CREATE USER 'usuario'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'usuario'@'localhost' WITH…
-
1
votes1
answer147
viewsA: Allow Multiple Providers with Authorize Attribute
Apparently everything is ok, but just in case, if you want to test the validation behavior, try reimplementing the method AuthorizeCore and debug inside it: protected override bool…
-
11
votes2
answers5551
viewsA: Generate random CPF in C#
Follows an algorithm I built to generate a valid CPF in C#: public static class CpfUtils { public static String GerarCpf() { int soma = 0, resto = 0; int[] multiplicador1 = new int[9] { 10, 9, 8, 7,…
-
2
votes1
answer240
viewsA: Generic Locate Method, using ADO.NET and Procedures
Yes, it would actually work analogously. Suppose the method List Selecionar(IEnumerable operadores), requested as an example: public override List<MeuObjeto>…
-
4
votes2
answers1101
viewsA: Distinct in the Plains does not work
That’s not how you use the Distinct(). The Distinct() filters only identical objects, which is not the case with your query. Use the method DistinctBy of the Nuget Morelinq package:…
-
2
votes1
answer227
viewsA: Copy Nodejs project to another machine
Just copy only the project folder or on the target machine I will have to do something? If your project uses npm, just copy the entire project source and run a npm install that everything is ready.…
node.jsanswered Leonel Sanches da Silva 88,623 -
3
votes1
answer68
viewsA: How to save Dysicpline?
There’s nothing in your Action to save. Obviously it won’t work. It has to be something like this: [HttpPost, ActionName("AddDisciplina")] [ValidateAntiForgeryToken] public ActionResult…
-
9
votes6
answers21826
viewsA: How to remove auto-fill inputs?
<input type="text" name="email" autocomplete="off" />
htmlanswered Leonel Sanches da Silva 88,623 -
3
votes1
answer4533
viewsA: How to bring only the records that have no association in the second table?
Something like that? SELECT s.cState,co.cCountry, ISNULL(c.TelephoneType,'NONE') AS 'Tipo Telefone', COUNT(*) AS 'TOTAL' FROM Customer c -- LEFT JOIN CustomerTelephone ct on c.nIDCustomer =…
-
2
votes1
answer1053
viewsA: Compiler Error Message: CS0433
Change the class name: public class MeuProfileCommon : ProfileBase { ... } Is colliding with the ProfileCommon native to . NET.
-
1
votes2
answers9820
viewsA: Character string not recognized as valid datetime
Convert.ToDateTime() does not give date format options. Utilize DateTime.TryParseExact: CultureInfo cultura = new CultureInfo("pt-BR"); DateTime minhaData;…
-
1
votes2
answers94
viewsA: Continuous integration TFS/Azure and Connection string in app.config
This blog shows a step-by-step to Web.config. How transformations apply to all project files if you have installed this extension of Visual Studio has a good chance of working. Since I didn’t test…
-
1
votes1
answer578
viewsA: Insert MYSQL into Web form C# - I cannot insert anything
Never fire an SQL this way: String InsertCliente = ("INSERT INTO tab_cliente (nome,cpf,rg,endereco,telefone,email) VALUES('Cl.Nomes','Cl.Cpf','Cl.Rg','Cl.Endereco','Cl.Telefone','Cl.Email')");…
-
2
votes1
answer3092
viewsA: How to create a login with different permission levels?
I’ll explain two: ASP.NET Membership and ASP.NET Identity. ASP.NET Membership It’s a standard data architecture designed to handle the users of an application. In this case it is assumed that your…
-
9
votes1
answer4542
viewsA: 3 layers vs MVC
That would be a 3-layer project? Yes, you defined 3 layers: data, business and presentation. I can consider that in an MVC project, the only difference is the exchange of BLL for a Controller? No.…
-
5
votes3
answers95
viewsA: How to use this!
Based on your Fiddle, made another. The .click is an event that should monitor the buttons by class to be efficient. That is, I defined the class for all its buttons and removed the div outside,…
-
3
votes2
answers324
viewsA: Generic repository with SQL
Yes, it is possible. I gave an example of generic DAL here. In fact the idea is a DAL that looks a lot like a repository, since the basic operations are generated from the class passed to the common…
-
1
votes2
answers466
viewsA: Multi Banks / Cache / Client Layer
We can use Nhibernate to do this? Yes, they can. Here is the list of database technologies that Nhibernate works with. The system has to have a cache to store data in memory and have quick access to…
-
1
votes1
answer32
viewsA: Problem when creating Profilecommon
This code would never work. Here you override the perfil mounted via Linq: perfil = (ProfileCommon) Create(userName, true); The right thing would be to keep only the Linq sentence. That line I…
-
3
votes1
answer1208
viewsA: Work unit (Unit of Work) with repository
Oren Eini, creator of Nhibernate, Castle Framework and collaborator of Ravendb, wrote the following text about why using repositories is no longer worth it. Ladislav Mrnka gave this answer in…
-
2
votes1
answer128
viewsA: Create Object Profilecommon in Asp.Net Membership
First it is important to say that Profile and Membership are two completely different things, so much so that Profile has its own library (System.Web.Profile). That object Profile is dynamic, so you…
-
1
votes1
answer609
viewsA: Update modal content dynamically
It is possible. By the way, there is an implementation in Codeplex where this is done as an extension: https://mvcmodaldialog.codeplex.com With it, you can put a link to your Modal like this:…
-
2
votes1
answer63
viewsA: ASP.NET Membership: Framework Exchange 3.5 to 4.5
A priori, no. There will be no impact on the Framework exchange unless you have made an implementation of your Membership that uses one of these structures in the implementation. In any case, the…
-
3
votes1
answer138
viewsA: How to update the . Net framework?
Right click on your project > Properties: In the option Target framework, select the option corresponding to the new Framework you will use: If the desired option is not among those displayed,…
-
6
votes1
answer403
viewsA: How do I maintain a Viewbag for all Controllers?
Make a ActionFilter: public class MeuActionFilter : ActionFilterAttribute, IActionFilter { void IActionFilter.OnActionExecuting(ActionExecutingContext filterContext) { ViewBag.User = // coloque aqui…
asp.net-mvcanswered Leonel Sanches da Silva 88,623 -
1
votes1
answer1420
viewsA: Jquery validate does not validate correctly
Use like this: bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include( "~/Scripts/jquery.validate.js", "~/Scripts/jquery.validate.unobtrusive.js", "~/Scripts/jquery.validate.globalize.js"));…
-
3
votes1
answer1474
viewsA: Login with Identity no MVC 5
Inside your file App_Start\IdentityConfig.cs, modify: public class ApplicationUserManager : UserManager<ApplicationUser> { public ApplicationUserManager(IUserStore<ApplicationUser>…
-
1
votes1
answer387
viewsA: Is there any technique for synchronizing a SQL Server database structure?
There is. Yeah the comparison of Schemas, within the SQL Server Data Tools.…
-
1
votes1
answer662
viewsA: LINQ with Left Join and Multiple Keys
It’s too long. It’s a classic example of code spaghetti. Try simplifying pro next: var faltas = (from dc in db.DiarioClasse join fn in db.Faltas on new { dc.Matricula, dc.CdDisciplina, dc.Turma }…
-
7
votes2
answers14235
viewsA: How to check if there is an element inside a list?
If I understand correctly: return listState.Any(l => l.nIDState == estado); Any is an extension of Enumerable. It checks if there is at least one item on the list that is equal to estado,…
c#answered Leonel Sanches da Silva 88,623 -
2
votes3
answers407
viewsA: How to implement the standard presented in C# with Entityframework?
I will try to give an answer that is not opinionated. This approach in trying to implement the standard would be a correct way? Apparently its architecture uses a database only, and each query…
-
4
votes1
answer4343
viewsA: Query works in the database but not via code
There are two things wrong with your code: try with catch emptiness; As I recall, the syntax for insertion in Oracle does not start with @, and yes by two-points; The right thing would be something…
-
8
votes2
answers1641
viewsA: Is it wrong to leave business rules on controllers?
Depends. I think it’s best to categorize by type of rule to make it clear. Data validations Yes, it is wrong. Data validation is a feature of the data type, therefore the responsibility of the…
-
2
votes1
answer39
viewsA: Lists do not load next to model
Find does not guarantee charge of dependent entities here: public virtual T BuscaPorId(int id) { return _dbSet.Find(id); } Explicitly load items to ensure they return as desired: public virtual T…