|
As Pete O'Hanlon said, you can. We use the Repository pattern + Unit of Work on the project I'm on right now. While we do use Code First, there is no reason it can't apply to Database First as well. Someone can correct me if I'm wrong, but I don't think the purpose of the Repository pattern was designed specifically for Code First. One advantage of using Repo is testing, another is dependency injection. It's simple to test using a Repository, from what I can tell here.
Read some more info here: http://stackoverflow.com/questions/8749153/why-use-repository-pattern-or-please-explain-it-to-me[^]
djj55: Nice but may have a permission problem
Pete O'Hanlon: He has my permission to run it.
|
|
|
|
|
How do I compare two tables and get the difference?
Dim dtBenefitsCurrent As New DataTable
dtBenefitsCurrent = objDB.GetPlanBenefits(groupID, planID, SequenceNumber)
Dim dtBenefitsPreviousYear As New DataTable
dtBenefitsPreviousYear = objDB.GetPlanBenefits(PreviousgroupID, PreviousplanID, PreviousSequenceNumber)
Dim dyDifference ????
|
|
|
|
|
Do you want to compare their structure, or their data?
The most obvious way is looping through the data, and looking whether the second table has the same. Exit as soon as they are not, or loop until the end and return a list of differences.
AFAIK, there's no built-in functionality to compare datatables and get a diff.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
am trying to get a message box to show a message when label reaches an set number like 5 on timer had a message pop up but it kept firing uncontrollably
this is what I want
'If Label3.Text = 1 Then
Message Box.Show("done")
End If
would like a sound to accompany message
can anyone point me in the right direction
Thank you
|
|
|
|
|
|
|
Please help me...
objCreateMasterBenefit.CreateMasterBenefitDocument return SpreadsheetDocument how can I output so users can choose to save/open doc in web apps...
Dim MemoryStream As New MemoryStream
Try
Response.ClearHeaders()
Response.ClearContent()
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml" '"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml" '"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" '"application/vnd.ms-excel"
Response.AddHeader("content-disposition", "attachment; filename=" & lblEditedPlan.Text)
Response.Charset = ""
Me.EnableViewState = False
objCreateMasterBenefit.CreateMasterBenefitDocument("Master_Benefit_"".xlsx", MemoryStream, groupID, planID, SequenceNumber)
MemoryStream.WriteTo(Response.OutputStream)
Response.Flush()
Catch ex As Exception
Throw
Finally
MemoryStream.Close()
MemoryStream.Dispose()
End Try
Response.End()
Response.End()
|
|
|
|
|
Are you asking how to put something in a MemoryStream? Or why your code doesn't work?
If the latter then you are going to need to explain more what it does do (versus what you want it to do.)
Also, but just guessing, your content type values seem much more complex than I would expect.
|
|
|
|
|
Try
MemoryStream.Position = 0
MemoryStream.WriteTo(Response.OutputStream)
Next to that, you'd want to rename that to have some other name than the class! Call it "MyCoolMemoryStream", but don't copy the name of the class and use it as a variable - makes stuff hard to read.
Also, you'd like to give that method that creates the file an enum, denoting "Excel XML" - the method itself should find the proper file-extension that should be used therefore.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I just notices most of the blogs I used to follow are no more updated by they creator.
What are the good .NET / C# / Application Lifecycle blogs with RSS feed of this moment. I prefer to follow people than organizations. I like blogger that write one article, news or tutorial by weak or month.
Thank you,
|
|
|
|
|
You have to go and look for them. There are many here on CodeProject, but if you want others then they could be anywhere.
|
|
|
|
|
I found the technical blogs on this website but I don't know how to subscribe to a RSS feed of these blogs
modified 13-Sep-14 22:22pm.
|
|
|
|
|
Post your question in the Articles forum and one of the administrators will help you.
|
|
|
|
|
Whilst prototyping a console app the other day, it stuck me that the dynamically linked library seemed somewhat redundant in .NET and that was nothing I could do with one that could not be achieved by creating an executable. I can add a reference and reuse publically declared types whilst with both. But an executable has some obvious benefits, yet I've always created DLLs because I've been told 'it's best practice' or just followed other's examples.
Can anyone think of a technical reason why you'd choose to build a library over an executable? Is a DLL an artefact simply for some legacy backwards compatibility that I'm unaware of?
Thoughts?
|
|
|
|
|
CatchExAs wrote: But an executable has some obvious benefits,
Like what?
The only "benefit" an executable has over a library is that it can be executed directly. For the vast majority of class libraries, executing them doesn't make any sense.
For example, what would you expect to happen if you executed mscorlib ? System.Data ? Etc.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
What if you required that they tested and verified themselves?
|
|
|
|
|
What do you mean by "tested and verified themselves"??
|
|
|
|
|
Say, main() by default was required to call a bunch of test suites that executed unit tests. I once worked somewhere where they did this btw.
|
|
|
|
|
Soooo, you're going to ship your unit tests with the code to the customer? That sounds stupid. That's like shipping the Paint Shop from the assembly plant with the car that it built.
|
|
|
|
|
Sounds more like including the diagnostic reader device with the car rather than requiring a visit to the shop when the check engine light comes on.
|
|
|
|
|
When was the last time you executed unit tests on customer site?
I've written seperate tools to diagnose database problems, but never to verify "the code". If the .EXE gets corrupted, chances are good it won't even run, and if it is corrupted, chances are good you've got hardware problems.
|
|
|
|
|
I never write or execute unit tests at all, anywhere.
I don't have the same concerns as the OP and I don't think we're talking about DLLs shipped with an application, but libraries provided to other developers for use in their applications -- like if I wrote an ISO 8601-compliant date handling library for example, but only distributed the DLL rather than the code.
Personally, when I get a DLL from some third-party (an ADO.net provider perhaps) I don't like having to create a Solution and Project, then add a reference just so I can use the Object Explorer to see what's in it. It would be convenient if it were an EXE and running it would provide (version-specific) documentation and such (hopefully more accurate than what's available on the developer's website, if any). Additionally, the Object Explorer only says what's in there, not how to use it, no documentation.
I suspect there must already be a tool that allows sort of a command-line Object Explorer, but I haven't looked. Certainly one could be written, but it still wouldn't provide everything that a custom baked-in tool would.
Seeing that given a DLL with some (public) class C with a (public) method M that takes a string parameter S and returns a string is all well and good, but wouldn't it be convenient to immediately be able to execute:
somelib test C.M "hello world"
and have it report the result? Without having to access an IDE and write a simple test app just to see what it does?
|
|
|
|
|
Or a compiler that bootstraps and tests itself?
Or an installable that operations can't f*** up?
There are always reasons for questions
|
|
|
|
|
CatchExAs wrote: Or a compiler that bootstraps and tests itself?
Really? How often do you see that and how often are you going to use it?
CatchExAs wrote: Or an installable that operations can't f*** up?
Depending on what you mean by "operations", yeah, right. If you're talking about people, there's nothing they can't f*** up and there's always some situation that you're code isn't going to be able to recover from.
|
|
|
|