WCF Data Objects Best Practice
Mar 24, 2011
I am in the processing of migrating from web services to WCF, and rather than trying to make old code work in WCF, I am just going to rebuild the services. As a part of this process, I have not figured out the best design to provide easy to consume services and also support future changes.
[Code]....
View 1 Replies
ADVERTISEMENT
Jul 26, 2010
I recall being told by a professor the following is bad practice. But it makes stepping through code a lot less tedious. I'm just solicting comments on pros and cons:
Friend Class MyClass
Private isEmpty As Boolean
Public Property IsEmpty() As Boolean
[code]....
View 3 Replies
Jun 10, 2009
say you have a database that you want to store 100 different recipes in. Out of that 100 recipes 20 have 5 ingredients, 30 have 7 ingredients, 30 have 4 ingredients and 20 have 6 ingredients. So what's the best practice for storing an unknown number of items in a database?
Currently what I am doing in these situations is storing them in a single field in a database separated by a comma. Then when I have to retrieve them I split them by the comma into an array. This doesn't seem right to me but I haven't noticed an impact on speed or efficiency, so what would be the best practice to handle this situation?
View 2 Replies
Sep 24, 2009
How do I handle user submitted data to ensure best practice programming? I would like to know what are the best practice programming tasks in relation to users submitting data through a web form to a website. I am particularly interested in any C# or VB.NET commands that should be used through out the process from the moment the user hits the submit button until the data hits the database. I have been reading about reasons why you may want to take precautions such as SQL injections etc.
View 4 Replies
Feb 8, 2012
What is the standard method for accessing back end data, which logon should you use? For example we have applications that require the user to login but then use an admin account to access the data from the backend.But there are also applications that require the user to login and use those credentials to access the backend data.We are in the process of creating an application that will require the user to login and would like to implement the more common method(standard practice) of accessing data.If there are alternatives those are also welcome.This will be made in ASP.Net 3.5 or higher and may include Windows Applications(VB.Net) as well.I dont want to have two sets of credentials. What I am asking is which credentials are normally used to access the Database. For example one one application may access 2 or more database's. Now would you use the same credentials they used to login to the application or would you use the admin account to access the data?Maybe this should be a seperate question but if I ended up using integrated security to access the database would the user be able to simply connect to the database using his AD account? Either through an ODBC connection and MS Access or equiv.
View 2 Replies
Jan 23, 2008
I am currently working my way through a MSDN Walkthrough titled Connecting to Data in Objects, the link for this is
[URL]
I have worked up to the section Adding Code to Load Data into the Customer and Order Objects section with no problems, but the Public Class Form 1 code is throwing an error hilighted in italics as per below,
Private Sub LoadOrders(ByRef currentCustomer As Customer) Dim orderData As NorthwindDataSet.OrdersDataTable = _ OrdersTableAdapter1.GetDataByCustomerID(currentCustomer.CustomerID)
This is the Description returned from the error list,
Error 1
Description - Value of type 'ObjectBindingWalkthrough.NorthwindDataSet.OrdersRow' cannot be converted to 'ObjectBindingWalkthrough.NorthwindDataSet.OrdersDataTable'.
[code]....
In the walkthrough I also came across a problem under the heading Modifying the Query on the OrdersTableAdapter to Return Only Orders for the Desired Customer This SQL throws an error,
SELECT OrderID, CustomerID, EmployeeID, OrderDate,
RequiredDate, ShippedDate, ShipVia, Freight,
[code]....
But the following edit to the Where clause gets around the error, the @ symbol is removed,WHERE CustomerID = CustomerIDcould this be causing the problems I am having described above, or is this just an error.
View 5 Replies
Jan 29, 2009
This is getting on my nerves. All the examples I keep finding deal with Consoles, all I'm trying to do is put data into an array of objects and output them into a Text box, but I don't know the syntax to do that.Here's my class
Public Class Student
Private SID As Integer
Private firstName As String
[code]......
View 5 Replies
Oct 12, 2010
I want to compare two objects whose type may be diffrent.
For eg, I expects 'true' for comparing 1000.0(Decimal) with 1000(Double) . Similary, it should return true if I compare 10(string) and 10(double) .
I tried to compare using Object.Equals() , but it did NOT work.It return false if two objects have different data types.
Dim oldVal As Object ' assgin some value
Dim newVal As Object 'assgin some value
If Not Object.Equals(oldVal,newVal) Then
[Code]....
View 5 Replies
Jun 22, 2011
I'm confused with this piece of code listed below. This code calls the update method of the dataadapter object to save the changes made to the dataSETback to the database itself. What I don't understand about this code is that it creates an update command(cmdUpdate), insert command (cmdInsert) and delete command (cmdDelete). My understanding is that the update method saves the changes back to the database. So I don't understand why the author creates these additional commands.
View 6 Replies
Feb 24, 2011
I have a thought about using a Serializable Collection containing both data objects and also sub-collections as a low-grade database, meaning it's going to store data objects that are expected to be added to regularly and deleted from occasionally.
View 3 Replies
Dec 6, 2009
I am trying to re-write an existing system with objects. I have created a few basic objects but am stuck on exactly how to get them to work how I want.These are the basic classes:
Public Class Course
Public AcadPeriod As String
Public AoSCode As String
[code]......
View 2 Replies
Jun 30, 2009
I am trying to retrieve the correct value from an ArrayList of objects (.NET 1.1 Framework):I have the following defined:
Public AlList As New ArrayList
Public Class ItemInfo
Public ItemNo As Int16
[code].....
View 4 Replies
Aug 20, 2009
Which is a better practice? (I'm coding in .Net if that makes a difference)
IF condition = true THEN
...true action--even if rare...
ELSE
[code].....
View 10 Replies
Jul 1, 2009
I have a SQL 2008 Express database, which have following tables: [code] Now I need SQL query to search for word (i.e. Beyonce Halo Music Video) against these tables.
-For Title exact phrase will get 0.5 points
-For Description exact phrase will get 0.4 points
-For tags exact phrase will get 0.3 points
-For title all words will get 0.2 points
-For description all words will get 0.2 points
-For title one or more words will get 0.1 points
-For description one or more words will get 0.1 points
And I will show these videos on basis of points. What will be the SQL Query for this? A LINQ query will be more better.
View 2 Replies
Feb 4, 2011
I'm writing in VB.net 4.0 and using SQLExpress 2008 R2. In a DataGridView, I would like to display (no edits) data coming from multiple tables in my database.A second Grid (different data, still multiple tables) will need to allow editing and saving of data.I understand creating a View in the database and using that as a source for the DataGridView.I also assume that there are ways to query and create a data source for the Grid totally within my VB program.Would someone explain the consequences and implications of the different approaches?
View 2 Replies
Apr 9, 2009
I am allowing users of the admin panel of my website to upload photos, its a simple process where I check the validity of the image and then save it to a folder, then I also have to record a couple of database records for that image to be able to retrieve it later, my saving function is as follows...The function that uploads and saves the picture in the folder with a name i construct in another function: [code] and the function that creates the database record for that same picture: [code] Now I know that what I am doing is full of best-practices violations, so please point me out to what I should do, keep in mind that the users might delete the pictures later, so I wanna make sure that I can delete the database and file of the picture, and the whole issue of the path.
View 2 Replies
Jun 25, 2009
What is the best practice while working with dataset amd datatable.Actually I have seen that very few information is online when it comes to working with multiple base table.Suppose there is one master table and a details table. The need of MASTER table is suppose just one column (say ProductName), while the application mainly works with the DETAILS table.My idea, we use JOIN to create a single datatable and work with it. But am surprised how little information is available when it comes to working with Multiple Base Table and the limitation of SQLCOmmandBuilder in such situation.
View 15 Replies
Dec 8, 2010
What is the best practice way of detecting internet connection?
From Windows Vista onwards, a status is set in windows that is displayed in the task bar. However, I cannot call this function/api/whatever, since some of the client pc's are still on xp, and only due for upgrade in 18 months.
so do i use and request something like [url]... to try and see it it works, and on the catch block set the return value to false, or is there another way?
Second part of this question, If no network connection is available, I can use [url]... to dial a connection. Will this use internet explorer's settings, or dial the connection marked as default in DUN?
Public Sub Life(ByVal AnyEvent As Object) Dim myNewLife As New Life Dim Happiness As New Collection Happiness.Add(AnyEvent) myNewLife.Experience(Happiness) End Sub
View 4 Replies
Jan 27, 2011
If I got Dim myRect As Rectangle = New Rectangle(0,0,100,100)Is it necessary or just fine to later do this: myRect = Nothing Or it isn't necessary?IF it is necessary, are there other cases it isn't for my variables?
View 2 Replies
Oct 5, 2009
A quick question on caching dataset objects. How can I know if the data is changed in Sql when caching data? I don't want to specify time constraints but used a strategy where data is changed in sql and I have to refresh my cache?
View 1 Replies
Jan 27, 2010
lets say I have:
arecord.name = "A"
arecord.value = 15 ' a number of type "long"
'
I then
call records.add(arecord,arecord.name)
' so far, so good but lets look at the next record
arecord.name = "B"
arecord.value = "this is text" as opposed to a number of type "long"
'can I then
call records.add(arecord,arecord.name)
View 3 Replies
Jan 19, 2011
All my data objects implement an interface IFillable
Public Interface IFillable
Sub Fill(ByVal Datareader As Data.IDataReader)
End Interface
In the objects themselves you will typically see something like
Public Class Supplier
Implements IFillable
[Code]...
Now here is the tricky bit. Given that all my property names WILL ALWAYS match my database column names what I want to do is using reflection generate the fill method at compile time and infer the types and column names for the datareader.I am assuming I will need to structure this functionality as some sort of a tool/vs plugin? What I am looking for is guidance on the best way to go about this.
PS: BTW: Obviously I could easily do this using reflection at runtime but I dont want to take the performance hit for it (Although theoretically if I could cache the values somehow (static class?) it might not be too bad).
View 3 Replies
Nov 26, 2011
I have a VB project with a large number of data sources in the data sources window. While the datasets behave well, the objects constantly expanded themselves to show all the properties. This means a lot of scrolling to find one.
View 10 Replies
Sep 10, 2011
this is not really a code issue, more of an events issue with objects. I want to be able to generate an output as the user inputs into each text box under the "further invoice details" section. For example, if the user inputs a value to amountrequired text box. Then a gross total is auto generated without the need to click a button.
[Code]...
View 1 Replies
Aug 17, 2011
I'm new at JSON and i am currently struggling with a problem parsing JSON data in a list of objects.The data that i am trying to parse is generated by the facebook graph api, and looks like this :
{
"100001621071794": {
"id": "100001621071794",
"name": "TEST1",[code].....
I know that this is not an array, because it is missing '[' and ']'. But when i replace the '{' and '}' with '[' and ']' i'm getting an error because of an invlaid matrix.
View 1 Replies
May 4, 2009
Can anyone point me towards a complete scenario using MSTest,vb.net, with or without mocks,MVP (supervising controller)
View 1 Replies
Mar 27, 2011
I need to share variables across two forms in vb.net. One of them is the main form and the other is a child form.
Create a static/shared variable in one of the forms and access it in the other forms via:
Form1 frm = new Form1(); //creating object of parent to access shared variable
frm.a = "abc"; // passing value
Send an instance of the main form to the child form when creating the child form. The variables can then be accessed via a property function. Create global variables in a module. This seems like the easiest option, but I doubt it is the best option.I also read something about delegates and events, but I don't know how to implement this.
View 4 Replies
Aug 23, 2011
I'm just wondering why using GoTo<label> is so frowned upon?I'm learning VB, and I want to develop good habits as I go. One thing I don't entirely understand, is why everyone avoids GoTo like its the plague (except in error handling...). I feel like GoTo could be useful in some situations.
View 1 Replies
Mar 27, 2012
Just wondering what the recommended practice is for importing namespaces. Are you always better importing the namespace like the fisrt snippet of code, or are you better to type the full namespace inline with your code.
I like both methods; the first is tidier and takes less code, the second can identify exactly where your accessing some logic from which can provide some clarity when looking over the code. Just wondering if there are pros/cons for either or if this is just a personal preference, currently I use a combination but would like to keep consistant.
[Code]...
View 2 Replies
Jan 21, 2010
Below two which is the best practice to compare strings...
If "A".ToLower = "a" Then
'....
End If
If String.Compare("A", "A", True) = 0 Then
'...
End If
View 2 Replies