Posts by Felipe Oriani • 1,186 points
23 posts
-
2
votes2
answers488
viewsA: Convert string array to string in VB
You can use the method String.Join that waits for a separator and parameters to concatenate and return a string (a collection in general). Example: Dim result as String = String.Join("", array)…
-
1
votes1
answer686
viewsA: Correct method to write to WEB API?
Come on, When you have a request to persist, you should take some precautions and adopt some good practices to avoid any problems. In the case of a requisition POST To persist something, you can…
-
4
votes1
answer6140
viewsA: Remove X first elements from a string
You can use the method string.Remove(int start, int count) that returns a string removing content. Contents of the MSDN documentation: Returns a new string in which a specified number of characters…
-
4
votes3
answers847
viewsA: Factorial is not being calculated
You can use a recursive function to solve this type of problem. For example (see comments): int fatorial(int n) { // caso n seja menor ou igual a 1, retorna 1, // ao contrário multiplica n pelo…
-
1
votes1
answer199
viewsA: Problems with Fluentnhibernate in hosting
This host is probably not configured to operate on Full Trust Level. Law on [Security Changes in the . NET Framework 4][1] and [Security Transparent Code, Level 2][2] in the MSDN for further…
c#answered Felipe Oriani 1,186 -
1
votes3
answers198
viewsA: Controller with Repository, Ioc and DI
Ideally, you have a way to solve the dependency of your types. For example, for your type UsuarioRepository is solved, this depends on ILetsPartyContext, which must also be resolved. Given that you…
-
0
votes1
answer806
viewsA: Process does not close in task manager
You could call the method Environement.Exit(0) that directly terminates the process of your current thread (your application in this case), for example: private void frmAgent_FormClosing(object…
-
3
votes5
answers7848
viewsA: What is the difference of string vs string?
String is the type System.String and you find it in any implementation of any language for . Net, is a type defined by . Net Framework. Already the string is a C# keyword that points to the type…
-
3
votes3
answers1195
viewsA: Entity Framework many relationship x many extra field
In this case, you need a type to set this extra value, making it impossible for you to have direct access to your class Person or Course. You can treat this relationship as a new one Entidade de…
-
2
votes2
answers4228
viewsA: Authentication in Restful Service
In the header of the request http you can pass an argument called Authorization. According to the http documentation, this argument by default expects you to report, a schema authentication and a…
-
5
votes1
answer619
viewsA: How to concatenate fields in the Line and rename
In C#, an anonymous object can be written as follows: var a = new { texto, numero }; and . net will be in charge of creating an object with properties with the names of the references you passed as…
-
5
votes1
answer560
viewsQ: Report progress to the interface of an asynchronous method in C#
I have an app Windows Forms. This application will perform some processes that take some time to execute, so I would like to run them in parallel. Follows a little of what I’m trying to implement.…
-
3
votes1
answer2236
viewsA: Dynamically Create Datatable
You can create a Datatable dynamically, but you must do it in parts. First define the columns and then insert rows according to the columns, for example: DataTable dt = new DataTable(); // defina as…
-
1
votes1
answer399
viewsA: How to display two pages of the same Gridview side by side?
With the component GridView would be more complicated. In this case, you can do this using server control DataList. In this component, we have the properties RepeatDirection defining the data…
-
2
votes2
answers183
viewsA: Show information when no data
I imagine the data is coming in your View asynchronously. In this case, you can have a html ready to display that message and keep it in a class css that hides. Your case Model come empty, you can…
asp.net-mvc-5answered Felipe Oriani 1,186 -
3
votes1
answer295
viewsA: Map a CHAR-like field in the database to a bool-like field in C#, with Fluentnhibernate?
In Nhibernate there is an abstract and specific Usertype for this case, called CharBooleanType, that allows you to mask a type char as bool. Create a class that inherits this type and override…
-
1
votes4
answers3125
viewsA: Dealing with collisions in Dictionary C#
Well, one way to check collisions before you include them in the dictionary is to use the method ContainsKey de Dictionary. This method allows you to check whether there is such a key for each…
-
1
votes1
answer106
viewsA: Is it bad practice to return Viewmodel from a Webservice?
I consider a Viewmodel in itself, as a representation of a model to a view. I don’t see as a problem the return of ViewModel from a Action or Web Service, since the information being returned is…
-
23
votes6
answers28585
viewsQ: How to get Timestamp in Javascript?
I’d like to know how I do in JavaScript to obtain the Timestamp? A number that represents the current date and time. I know we got the object for date and time through: var d = new Date(); But I…
-
3
votes4
answers6431
viewsA: How does the interaction between the layers in C# work and what is the function of each one?
Your question is too broad for a simple answer here, but the ideal would be: Modelo -> Dados -> Negócios -> Controller If there is a need to distribute, a layer of this type: Modelo->…
-
5
votes3
answers882
viewsA: How to insert an extended value into a table in a varbinary column?
You can use a function OPENROWSET, example: CREATE TABLE Tabela(NomeArquivo nvarchar(100), Arquivo varbinary(max)); GO INSERT INTO Tabela(NomeArquivo, Arquivo) SELECT 'Texto.txt' AS NomeArquivo, *…
-
1
votes4
answers5177
viewsA: How to handle vectors in a Mysql database?
The ideal would be to add a table to associate the relationship between Sale and Product, and in this apply the quantity, example: FK_VENDA FK_PRODUTO QUANTIDADE 1 1 5 1 5 10 1 3 7 1 4 13 1 9 2…
-
17
votes5
answers2401
viewsQ: How do I merge two results of a query?
I am developing an application in C# and I would like to know how to put together two results of two darlings SQL in one. I have the following code: public List<MalaDireta> ObterMalaDireta() {…