|
You have a choice, depending on your database you can add triggers spit to audit activity or you can add some sort of auditing to your DAL in c# that records each activity into the database.
Personally I create triggers spit in the database to audit all master file tables IE I do not audit transaction tables.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
Keypress and keydown event occurs when click on flexgrid control but value is not showing.when use doubleclick event is working that.
|
|
|
|
|
FlexGrid? Why on earth would you be using such an ancient control?
Your question doesn't make sense. What value? Why are you using the KeyPress and KeyDown events? For what? What is the DoubleClick event being used? For what? What are you expecting to work that doesn't?
Oh, and change your username to something other than your email address, unless you like getting bombarded by spam emails. NEVER post your email address in a public forum.
|
|
|
|
|
Hello All,
This is my first application in asp.net core
Table Like this ->
PublisherMater : PublisherId,PublisherName,TotalBooks
PublisherDetails: BookName,ReleaseDate,AuthorName
My question is : I want to manage master and details entry using asp.net core mvc with code first approch.
first step : Create Model
secound : Create MVC Controller with view using Entity Framework
anybody have any example like this ?
Thanks in advance
|
|
|
|
|
Your tables are bad. You should not be putting "TotalBooks" in the PublisherMaster table at all.
What you should be doing is something closer to this:
public class Publisher
{
public int PublisherId { get; set; }
public string PublisherName { get; set; }
public ICollection<Book> PublishedBooks { get; set; }
}
public class Book
{
public int BookId { get; set; }
public string BookTitle { get; set; }
public string AuthorName { get; set; }
public Date? ReleaseDate { get; set; }
}
Every publisher can publish any number of books, hence the collection in the class.
|
|
|
|
|
|
Could you help to explain how can I Great Forms (GUI) in MAC using Visual studio 2019?
|
|
|
|
|
Quote: Mac Apps using Xamarin and C#
Visual Studio 2019 for Mac - IDE for macOS
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
It's called WinForms, and works under Mac.
Anything else is not great; WinForms has usability, predictability, and accessability. The latter meaning it works even for those who see less. Predictability means a button is recogizable as one, meaning users don't need expensive education. Usability means they find that on their own.
So, to be short; a great UI is a non MAC one.
Bastard Programmer from Hell
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Exactly the same way you would do it in Windows. Use the installed templates to create the application in the framework of your choice.
|
|
|
|
|
For the purposes of an OAuth 2.0 Client, I need to parse a HTTP GET with no body, and return either this pre-canned HTML (success) or that pre-canned HTML (fail), maybe serve up a bit of CSS and an image or two. Every other request I can respond 404.
I have elsewhere explained that I can't use anything based on System.Net.HttpListener for this purpose, because that puts me in the situation of needing to elevate privileges on the host at least *sometime previously* ... but this app is ClickOnce so-as-to-avoid-the-need-for-admin-rights ... especially the need for admin rights in order to setup the app to receive an OAuth 2.0 authentication code!
System.Net.TcpListener dodges the 'urlacl' infrastructure though. Sure, it puts more responsibility on me to 'be a webserver', but as explained, the 'functional surface area' of this web-server is quite small. So whether I write-my-own or import some dependencies, I feel like this *should* result in either a little bit of code, or a few minimal dependencies.
Is this expectation reasonable, do you think, or are there gremlins in the forest? Are there any minimal 'sits on top of TcpListener' HTTP libraries/servers you are aware of?
|
|
|
|
|
|
Big relief: https is NOT required for OAuth 2.0 redirect_uri which use 'localhost' as the hostname (at least with Xeros Authentication Server anyway ... it is possibly a requirement of the spec).
A good thing too, or else presenting a clean certificate for 'localhost' to the user's browser (kind of super-important when getting the user to trust your app to access their resources) would require presentation a self-signed cert that's trusted by the host. Which would require generating and adding adding it to the trust store at some point in time prior to the moment it is used. Which would require privilege-elevation prior to the moment it is used. Which we are trying to avoid with ClickOnce.
|
|
|
|
|
My program is going through each word in a story looking for names. I am using the following function to check against a string full of names (aaron, adam, ...) to see if the word is a name, but it is returning true for partial word matches such as "the" in "Theodore". What am I doing wrong?
Public Function WordExists(ByVal searchString As String, ByVal findString As String) As Boolean
Dim returnValue As Boolean = False
If System.Text.RegularExpressions.Regex.Matches(searchString, "\b" & findString & "\b").Count > 0 Then returnValue = True
Return returnValue
End Function
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If WordExists(NameList, TextBox2.Text) = True
Then MsgBox("Yep!")
Else MsgBox("Nope!")
End If
End Sub
Thank you for your help!
Amerigo
|
|
|
|
|
You should check the next character for a space, period or line terminator to determine the length of the word.
Never underestimate the power of human stupidity -
RAH
I'm old. I know stuff - JSOP
|
|
|
|
|
I would like to submit my reasoning for validation/sympathty. If your head is not already full of OAuth 2.0 the language here might not make sense.
Some context is required:
* The Resource Server is Xero
* The Authorization Server is Xero
* The Authorization Server permits registration of Clients which use either the 'Authentication Code Flow' or the 'Authentication Code + PKCE Flow'
* The Authorization Server correctly requires Client registrations to supply a 'redirect_uri'
* The Authorization Server incorrectly requires Client registrations to supply a 'redirect_uri' only with an https:// prefix
* The Client is my .NET desktop ClickOnce app
* The User Agent (browser) runs on the same machine as the Client, in the same desktop session
* the User making the OAuth 2.0 delegation does not otherwise need admin rights to the machine
... and the Dev (not really the subject of an OAuth spec, thank heaven!) just wants to get on and write his business logic.
Right, so back to work:
To get an access token, we first of all need an authorization code. We get that from the Authorization Server through the 'front channel' ... the User's User Agent (ie. a browser) is given an HTTP redirect to the 'redirect_uri' with the information we need in an HTTP request.
And here we run into 'hassle'.
IF our Client were an Android, iOS or UWP(?) app, we could have registered for a 'Claimed Https Scheme URI Redirection' ... when the User Agent (browser) visits https://example.com/, it will activate the app and send the URL to us! (so long as we can convince the respective app store WE own example.com ... it's all in the app manifest).
But ... that's not us. We're a 'legacy' app on Windows. Well, we could use a 'Custom URI Scheme' and register 'com.example.myapp:/foo' with Windows, which would (after a browser prompt) activate our app and hand the URI over to it (maybe ... it isn't clear if we can do this for ClickOnce apps that are 'installed' in each user's roaming profile). We get the same effect as with the Claimed HTTPS URL approach.
But ... that's not us. Xero won't let us use a Custom URI as the 'redirect_uri' anyway
(The article Redirect URLs for Native Apps on Okta (a competing Authorization Server) lays these things out quite neatly. Ldapwiki: Claimed Https Scheme URI Redirection on JSPWiki is more jumbled, but references RFCs).
That leaves us with ... running a quick webserver on the loopback/localhost address. Our 'redirect_uri' becomes 'https://localhost:1234/myapp'
Now we have to nominate a port to bind to, that is 'guaranteed' to be available at runtime! Fortunately, we can do bit of a scattergun and nominate *multiple* redirect_uri (https://localhost:5678, https://localhost:6789, etc) when registering our Client with the Xero Authentication Server (or we'd be sunk, basically, if another long-lived app decided to bind to the port we'd chosen).
Great, so we find an available port. Now to bind an HttpListener to the port and wait for the User Agent to hand control back to us.
So we either need:
* admin privileges to bind the port without a 'urlacl' reservation; or
* to have previously done something like "netsh http add urlacl url=https://+:1234" (for at least the redirect_uri variants we have chosen to use at runtime) ... which requires either that we set this up when we had elevated privileges when we installed our app (or not ...since we are ClickOnce), or that we obtain such privileges NOW to do the "netsh http add urlacl" work.
In either case, we now need to refactor a part of our app out to a separate process and arrange for it to run as admin ... which we never intended for our user to have to do ... so that they can delegate the right for our app to access their Xero accounts. Thankfully they only have to do this INFREQUENTLY, but they'll need someone with local admin rights standing over their shoulder when they do
modified 15-Sep-20 10:50am.
|
|
|
|
|
Hello folks, my first post after years of lurking. The burden of the out-of-date articles on the Internet around .NET technologies is getting really heavy, and I can't quite locate reliable info, and I'm blocked on this.
I have asked the question on Stack Overflow, but the quality of the related answers is not encouraging me I'll get a bite. I guess all the real veterans hang out here!
I basically would like to force the UAC prompt to do some stuff as admin. I understand I will need a new process and must arrange IPC between the unprivileged-parent and the privileged-child (sounds familiar ).
But I don't know if using
System.Diagnostics.ProcessStartInfo.verb = "runas" is the go, or if there is a Better Way Today. There are articles here and there about using the app.manifest which I can't seem to apply in VS 2019 - they feel defunct. (.NET Framework itself is starting to feel defunct, actually).
TIA
|
|
|
|
|
Either the runas verb or an application manifest should work.
I'm not sure whether you'll be able to use IPC from the unelevated app to the elevated app. And if you can, you need to be extremely careful to secure it, so that it can't be used by malicious code as an elevation of privilege attack vector.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: I'm not sure whether you'll be able to use IPC from the unelevated app to the elevated app.
Thanks Richard. For IPC, I hope I can use anonymous named pipes between the processes, per Microsoft's own How to Use Anonymous Pipes for Local Interprocess Communication. I imagine the privileged-child will be able to connect to the pipe created by the unprivileged-parent without issue if it has the token.
To pass the result of (new AnonymousPipeServerStream(/*etc*/)).GetClientHandleAsString() to the privileged-child, I will pass it as a command-line argument.
I suppose a malicious application could create its own named-pipe, invoke MY privileged-child app to fool the user into approving the UAC prompt (abusing my good name) and then control the privileged-child process from their malicious app. Fortunately I only really need the pipe for signalling the privileged-child to stop ... not to direct the action of the privileged-child.
Since I'll be working with ProcessStartInfo anyhow, adding a 'runas' verb is 'within easy reach'.
It then becomes a question of whether anything is gained by going declarative. Yes, if I needed the 'verb' for a different purpose, I guess. Or if I wanted the privileged-child code to be useful to an audience wider than my app. No, if I am happy for my privileged-child to fail unless properly invoked by MY code (heck, I could even take steps to make it a lot harder for said malicious actor!), or if I don't wish to draw the attention of malicious parties by marking it 'hey, I run as admin!'.
|
|
|
|
|
I'll go ahead and try these things right away. I solved my app.manifest issues by ticking the 'NET Desktop Development' profile in the VS 2019 installer!
|
|
|
|
|
Hi I have an Entity as below:
public class Complaint
{
public Complaint()
{ }
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Index("IX_UniqueConstraintComplaint", 1, IsUnique = true)]
public int? InspectionRequestId { get; set; }
public InspectionRequest InspectionRequest { get; set; }
[Index("IX_UniqueConstraintComplaint", 2, IsUnique = true)]
public int? InspectionResultId { get; set; }
public InspectionResult InspectionResult { get; set; }
[Index("IX_UniqueConstraintComplaint", 3, IsUnique = true)]
public int? CaseId { get; set; }
public Case Case { get; set; }
[Index("IX_UniqueConstraintComplaint", 4, IsUnique = true)]
public string ComplaintId { get; set; }
}
I want to rename this entity as below with couple of column names changed, can somebody please help me in this
public class RequestResultCaseComplaint
{
public RequestResultCaseComplaint()
{ }
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int RequestResultCaseComplaintId { get; set; }
[Index("IX_UniqueConstraintComplaint", 1, IsUnique = true)]
public int? InspectionRequestId { get; set; }
public InspectionRequest InspectionRequest { get; set; }
[Index("IX_UniqueConstraintComplaint", 2, IsUnique = true)]
public int? InspectionResultId { get; set; }
public InspectionResult InspectionResult { get; set; }
[Index("IX_UniqueConstraintComplaint", 3, IsUnique = true)]
public int? CaseId { get; set; }
public Case Case { get; set; }
[Index("IX_UniqueConstraintComplaint", 4, IsUnique = true)]
[Required]
[StringLength(20)]
public string ComplaintId { get; set; }
}
I previously had the entity as in the 2nd case, unfortunately I removed it, and now when I am trying to create with same name again, whether EF has cached it I don't know, but EF is not recognizing it, can somebody please help me in this, does EF cache the already created Entities with same names, how can we clean it?
Its not allowing me to create the same Entity again even after deleting the Entity and trying regenerate again.
Or at least can I rename already existing Entity and its columns, how can I do it any help please?
|
|
|
|
|
|
If you're still in development, and using Code First, then just nuke the database / tables.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Funny - I don't have nuke weapons ,
I did achieve it, I manually wrote up and down methods and ran them against, challenging, scary but did it, thank you both for the help buddies.
|
|
|
|
|
Message Closed
modified 7-Sep-20 14:02pm.
|
|
|
|
|