Posts by Renan • 4,628 points
142 posts
-
8
votes1
answer77
viewsA: Error while trying to add numbers in an int32 array
The array is a reference type and needs to be initialized. Replace the code: m_FluxosPlataformas = { 4, 7, 8, 9, 10 } ; For: m_FluxosPlataformas = new Int32[] { 4, 7, 8, 9, 10 };…
-
1
votes1
answer142
viewsA: Modifications to model and relational database
Your concern in not to let there be a great distance between the relational data model and the domain model is really important, but we have to Domain Model: Contains knowledge about a…
-
1
votes1
answer143
viewsA: How to format Webgrid Currency column?
One option would be to replace this code: <strong>Valor Doc.:</strong> @item.ValorDocumento By that code: <strong>Valor…
-
0
votes1
answer108
viewsA: How to map the Relationship to the base class in Table per Type (TPT)
To map the relationship of the base class Person to City so that derived classes Personal and Personal can be recorded with their respective cities it was necessary to add a collection property/list…
entity-frameworkanswered Renan 4,628 -
0
votes3
answers109
viewsA: How to test Entity Framework performance?
TPH (Table per Hierarchy) All entities in the hierarchy will be mapped to a single table. So, no need to do joins to recover the data, generally having a better performance compared to TPT. The…
-
2
votes1
answer108
viewsQ: How to map the Relationship to the base class in Table per Type (TPT)
I have the following scenario: Each entity in this hierarchy has its table. But, now I need to register a Person with a City where she lives. How to map so I can record a City in a Person? Classe…
entity-frameworkasked Renan 4,628 -
1
votes1
answer159
viewsA: How to load an entity State-related Parents
Using exactly the code of the question I got. It’s the first time I’ve ever worn Toad for Mysql. I realized I had two versions of it on PC: a 7.3 another 7.7 (and so far I was using the oldest…
-
1
votes1
answer159
viewsQ: How to load an entity State-related Parents
I’m starting out in the Entity Framework and when trying to load a State entity, the related Parent entity is coming with null value, which I could adjust in my code to resolve? State class: public…
-
5
votes1
answer68
viewsQ: Complex type can have Entity Type property?
I have a class Address that is Complex Type. She can own a state property that’s a Entity Type? Class code: public class Endereco { ... public string Logradouro { get; set; } public Estado Estado {…
-
1
votes1
answer305
viewsA: Sync with Team Explorer on VS 2015
You may have (new/changed) files that are not in your commit (Untracked files). It is possible to identify them by Git command prompt. Navigate to the project/repository root directory (example cd…
-
5
votes2
answers136
viewsQ: Complex type bind with Angularjs
I am studying Angularjs and Asp.net MVC and could not bind a property CPF class Person when performing a POST: Classe Pessoa: public class Pessoa { protected PessoaFisica() { } public Int32…
-
3
votes2
answers928
viewsA: How to scan a string and check content within it?
The method Contains() returns a value indicating whether a specified character substring occurs in this character string. string suaString = "Olá mundo"; if (suaString.Contains("Olá") == true) {…
-
2
votes2
answers812
viewsA: How to count columns of an Httppostedfilebase txt file?
You need to create an action in your Controller to receive the file: //Importando arquivos public ActionResult Importar() { return View(); } Your View needs a file upload field: @using…
-
3
votes1
answer158
viewsA: Insert CSS to show dependencies
If I understand you, you need something like: One option is you add a div after each table example: <div> <img class="seta310" src="arrow.png" /> </div> Once this is done, you can…
-
3
votes1
answer282
viewsA: 404 ASP.NET MVC fails when attached file is large
There is a size limit for uploading files to ASP.NET. But there is the possibility to set and increase the limit. Try to configure the maxRequestLength on your Webconfig and run a test.…
-
1
votes1
answer338
viewsA: How to take a Domain Entity method to higher layers
In the DDD, when we need to create a complex entity it is necessary to use a factory (what the DDD calls Factory) of objects so that we can reuse it throughout the project. Thus, you can create an…
-
2
votes3
answers1435
viewsA: How to convert an Object into an Array? (c#)
You need to use an ORM as Entity Framework or Nhibernate, because the purpose of the ORM is to accurately map between the fields/properties of your object and the fields/properties of your table in…
-
0
votes4
answers579
viewsA: Get the date and time the computer called
I read some examples where you can use the namespace System.Diagnostics.Eventing.Reader to access the logs of Event Viewer and get that information. Although I don’t have an environment to try a…
-
3
votes2
answers2201
viewsA: Person registration using multiple viewModels and only one controller
A Viewmodel represents a set of one or more Models and other data that will be represented in a View that needs to display a certain set of information. Then, you can take advantage and use Personal…
-
2
votes1
answer126
viewsA: What is the difference between a WCF Service and a Duplex Service?
What’s the difference between a WCF Service and a Duplex Service? In WCF we can configure the types of messages exchanged between client and WCF service, Duplex is one of these types of messages: In…
-
5
votes2
answers516
viewsA: Should the Domain layer depend on Infrastructure?
The Domain layer must depend on Infrastructure? Yes, the Domain layer depends on the Infrastructure layer to perform data persistence in the database. However, what the DDD guides is that the Domain…
-
1
votes2
answers23279
viewsA: How to remove an old commit
I found an explanation that I believe can help you, but I could not test, I recommend you create a repository with branchs and perform a test, because these are commands that should be very careful…
-
1
votes2
answers1110
viewsA: Disable Dropdownlist in View
You can use Jquery. In the View that renders the editing page, you normally display your dropdownlist, but adds the following Jquery code: $(document).ready(function() {…
-
1
votes2
answers640
viewsA: How to return all records from a table
I believe that’s exactly how Tobymosque responded, just complementing: Why not use Firstordefault() in this case? Firstordefault() returns the first element of a sequence or a default value if no…
-
3
votes2
answers607
viewsA: Foreach duplicating the data
As posted by @Maniero, the view should have as little processing as possible, ideally you simply display the value in the view and not keep converting data etc... Consider the code below only if you…
-
4
votes2
answers2309
viewsA: 'Data Access Layer' is the same as 'Data Access Object'?
Are different things. DAL (Data Access Layer) - It is a project/layer responsible for the structure for access and persistence of application data. It is an architecture standard for separating the…
-
4
votes1
answer2076
viewsA: Using two entitades in the same View
You can create a single Viewmodel that includes the Holiday and Requirement information you want to save. Viewmodel represents a set of one or more Models and other data that will be represented in…
asp.net-mvcanswered Renan 4,628 -
3
votes1
answer580
viewsA: Dependency registration responsibility (Ioc, DI, n-layer architecture)
...it would be correct to let the presentation layer create the container and record the required dependencies? Not. The Presentation Layer is responsible for displaying system information to the…
-
3
votes1
answer347
viewsA: Popular a List with database data accessed by Entityframework
Consider that you already have your class that you inherit from Dbcontext configured to work with the Entity Framework... example: public partial class SeuDBContext : DbContext { ... public…
-
3
votes1
answer309
viewsA: VS 2012 Bundles use or not use, that’s the question!
1 - Is this approach worth using? Why? When we talk about website optimization, we need to look at every detail that can decrease processing or traffic, use Bundle allows you to make a grouping of…
-
11
votes3
answers11626
viewsA: What’s the use of the reserved word "Yield"?
Yield returns an object that implements the interface Ienumerable, namely a iterator. Follow an example, where yield return is used to return a validation message list: using System.IO; using…
-
4
votes3
answers698
viewsA: Unit tests with Nunit
You must run the test methods in Nunit. 1- Open the Nunit 2- In the menu File click Open Project and select your project’s dll, example Your project.dll. Test methods, marked with [Test]. 3- Select…
-
2
votes2
answers351
viewsA: Binding in text field
As in the Dropdownlist you put value="@User.Identity.Name", in the form post you will receive the user name and not the ID. An alternative would be for you to use a Hidden with the value of the user…
-
3
votes1
answer628
viewsA: Generate database backup via application
It is possible yes. You need to mount in your C# code the sql command of backup and run it, something like: Open the connection and mount a query which executes the command to do the backup as the…
-
1
votes1
answer526
viewsA: How to set a default value created by the user in the creation of a table (SQL Server)?
You can set the value default field "num" when creating the TEST table like this: CREATE TABLE TESTE ( num int DEFAULT (0) ) This "CREATE DEFAULT" feature will be removed in a future version of…
-
8
votes1
answer252
viewsA: Generate database backup
If you just want a script Transact-SQL to do the backup, you can use something like: USE SeuBanco; GO BACKUP DATABASE SeuBanco TO DISK = 'Z:\SQLServerBackups\SeuBanco.Bak' WITH FORMAT, MEDIANAME =…
-
1
votes1
answer756
viewsA: Fill foreign key with primary key value
In the mapping you can configure for Nhibernate to generate the ID automatically for you, then you will have something like this if you are using Nhibernate: <id name="Id"> <generator…
-
4
votes2
answers518
viewsA: How I debug a method in a Web Service . asmx
To debug from Visual Studio you must attach (attach) to the working process (Work Process) ASP.NET. I’m not with Visual Studio at the moment but I believe these are the following steps: 1-Start your…
-
4
votes1
answer172
viewsA: Interface, interlinking of layers
The use of the interface is only in the interlinking of layers? You can use interfaces between layers if you want to maintain a low coupling/dependency between layers. But the use is not limited…
-
1
votes1
answer74
viewsA: Persist in my database values passed by a Dropdown in my html?
You can create a class to be your own Model which will contain the properties you want to persist and a list type property for the user to select the UF like this: public class SeuCadastroViewModel…
-
0
votes1
answer167
viewsA: How do I get the value of the parameter sent by a view and persist in the database?
You probably have a Model with the fields of your register, for example: public class CadastroViewModel { //Propriedades para cadastro do cliente.... public int CodigoCliente { get; set; } } In his…
-
2
votes2
answers713
viewsA: How to instantiate primary key in another MVC class?
I want to create a Projectofuncionario class... There is no need to create a class like Projectofuncionario to express these relationships. This usually occurs when creating the database tables,…
-
5
votes1
answer1217
viewsA: What problems can occur when using the "http://tempuri.org/" namespace on our webservices?
There is a recommending where each service needs a namespace unique so that client applications can distinguish you from other web services. http://tempuri.org is the URI test pattern used by…
-
2
votes2
answers1301
viewsA: Doubt about Request.Form
Request is an ASP.NET class that allows reading values sent during a Web request. What is Request.Form? It’s a property (Request Form.) of the Request class you can use to retrieve the values of the…
-
1
votes1
answer332
viewsA: Inheritance in Database
From what I understand Design and Banking are types of User. You can use a table only and create an extra field in this table (Typousuario for example), to identify the user type. This field can…
-
0
votes5
answers3666
viewsA: How do I know the last commit to move the same file as my commit?
I do not know if I understand correctly, but I will try to answer the part below that I have taken from your question. If that’s not what you’re looking for, try giving examples to try to help.…
-
1
votes1
answer133
viewsA: Select and move to graphical interface
I believe you can do something like: public List<Fornecedor> GetAll() { var listaDeFornecedor = new List<Fornecedor>(); string sql = "SELECT * FROM Fornecedor"; using (var cmd = new…
-
1
votes3
answers936
viewsA: HTML Helpers in ASP.NET MVC 4
Labelfor uses its configured Model in the View to render a Label. Example: // Model public class SeuModel { [DisplayName("Propriedade do model")] public string SuaPropriedade { get; set; } }…
-
1
votes1
answer525
viewsA: What is the difference between the types of WCF projects?
Roughly: WCF Service Application Creates a preconfigured WCF application to be hosted on IIS. WCF Service Library Create a WCF application that will be added as a reference for use in another…
-
1
votes1
answer344
viewsA: Two models and a controller
...I could use a controller to do the manipulations on the tables ? Actually the controller does not manipulate tables. Commenting roughly, the controller receives requests from the GET/POST user,…