My core usecase is to read/write from database and directory server.
Eg.
createUser,
modifyUser,
associateGroup,
changePassword etc
I have several other functionalities to be done in several of these use cases.
1.) audit start of operation
2.) audit failure in case of exception/error
3.) validate data
4.) persist in db
5.) persist in directory server (LDAP)
6.) notify in somecases like password change
7.) audit success
8.) future something else
I am thinking of implementing this in some kind of decorator design pattern is there some better suggestions ???
Thanks,
Vignesh
The data should have been validated long before you persist it. Move that code up to where the service receives the request.
"Persist in DB" and "Persist in database server" are the same thing. You're overcomplicating it. Your comment suggests that you should prefer wording to distinguish between a relational database and a directory, but my conclusion doesn't change.
Notify for password change is a separate use case.
The only thing that qualifies is logging the start, completion, and error. You can do this easily with an around aspect if you use a language or framework that supports AOP, like Spring. It's a middle tier feature.
Related
How do I add a new message type to an existing contract?
CREATE CONTRACTand DROP CONTRACT commands exist, but no ALTER command.
ALTER CONTRACT is not amiss due to omission, is missing by design. This is exactly like asking to change COM interfaces: is not supported, because the interface is a contract. If one party changes the interface, it breaks the contract and will cause the other party to crash when calling the wrong v-table entry. Exactly the same reasoning was applied in Service Broker design: one party cannot change (ALTER) the contract and start sending some new messages the other party does not expect, it will cause it to crash (error in the message processing procedure). Contracts are immutable.
If you say 'but I can ALTER the other party too' then you are not considering real use cases, when the other party is remote and often under a different administrative control and not willing to change its contract(s). even when a change is possible, deploying a distributed change that requires many side to roll out new bits is just asking for (unnecessary!) downtime.
Changes in communication pattern must be deployed as new contracts. Services can implement multiple contracts, and adding a new contract to a service (via ALTER SERVICE) is supported. Changes in distributed apps are rolled out by deploying new contract(s) while still supporting old one(s), then retiring old contract(s) (ie. overlap).
From here:-
A poor workaround to this would be to version all changes as new
contracts but that would require an additional service and queue and
existing conversations would not be able to benefit from the new
message type.
I highly recomend support for an alter contract command but also add
support for SSDT to issue an alter command instead of drop/create.
I highly reconsideration of this request. Or at a minimum: Add a check
and error message to be raised from SSDT whenever any conversation
exists that uses that service and/contract before dropping in a
similar way that SSDT checks for existing data in a table before
dropping said table. This would at least help raise awareness of this
side-effect and would have prevented deployment headaches.
I'm looking for a robust module that will monitor an email account (ideally POP) and load each new email into a database (or cloud-based storage solution) as it arrives. This can either be an open source module, a commercial module or even SaaS. Ideally, would be easy to use from .NET.
Simply put, trying to avoid re-inventing the wheel.
Do you know of any such modules or services? Did you have a positive experience with them?
I've used Email2DB with some success.
http://www.email2db.com/
You can set up your own parsing rules for incoming e-mails and place data wherever you see fit as a result.
How about OpenPop.net? That won't automatically save it to a db, but you should be able to consume it from the POP3Client object.
I'm trying to build a web application using Orchard, but I have a page that saves data in a database. How can I connect to the database and save this data to it using Orchard?
Thanks
To pass the data to another database you need to be careful as your quite likely to end up with transaction errors.
Create a normal ADO connection using whatever method you would normally do to do it, and then wrap this in a supress transaction. This is because Orchard uses a per request transaction which means you will always be inside a transaction, this means that once you try to connect to a second database the connection will try to elevate to MSDTC, if this is okay then you dont need the suppress statement, but if you dont have this configured... then supress it.
It depends. What kind of data? Do you want to let Orchard take care of the data persistence or do you want to handle your own database?
If you want to handle it yourself, well, just do: it's just MVC.
If you want to let Orchard do it, the easiest is to handle that data as a content type and there are plenty of tutorials in the Orchard docs for that sort of thing.
Take a look at the Contact Form module in the gallery, it is a great reference.
http://orchardproject.net/gallery/List/Modules/Orchard.Module.CyberStride.Contacts
We are building a webapp which is shipped to several client as a debian package. Each client runs his own server. But the update and support is done by us.
We make regular releases of the product, with a clean version number. Most of the users get an automatic update (by Puppet), some others don't.
We want to keep a trace of the version of the application (in order to allow the user to check the version in an "about" section, and for our support to help the user more accurately).
We plan to store the version of the code and the version of the base in our database, and to keep the info up to date automatically.
Is that a good idea ?
The other alternative we see is a file.
EDIT : The code and database schema are updated together. ( if we update to version x.y.z , both code and database go to x.y.z )
Using a table to track every change to a schema as described in this post is a good practice that I'd definitely suggest to follow.
For the application, if it is shipped independently of the database (which is not clear to me), I'd embed a file in the package (and thus not use the database to store the version of the web application).
If not and thus if both the application and the database versions are maintained in sync, then I'd just use the information stored in the database.
As a general rule, I would have both, DB version and application version. The problem here is how "private" is the database. If the database is "private" to the application, and user never modifies the schema then your initial solution is fine. In my experience, databases which accumulate several years of data stop being private, it means that users add a table or two and access data using some reporting tool; from that point on the database is not exclusively used by the application any more.
UPDATE
One more thing to consider is users (application) not being able to connect to the DB and calling for support. For this case it would be better to have version, etc.. stored on file system.
Assuming there are no compelling reasons to go with one approach or the other, I think I'd go with keeping them in the database.
I'd put them in both places. Then when running your about function you quickly check that they are both the same, and if they aren't you can display extra information about the version mismatch. If they're the same then you will only need to display one of them.
I've generally found users can do "clever" things like revert databases back to old versions by manually copying directories around "because they can" so defensively dealing with it is always a good idea.
I am using LLBL Gen Pro v2.6 and am attempting to create a means of auditing changes made to the database. Now, I know that LLBL Gen has auditing built into it using AuditorBase and dependency injection. The question I have is; I need to track not only the stuff that LLBL Gen exposes as auditable, but also the User who made the changes. From what I've seen there isn't a built in way of gathering this information. Has anyone used LLBL Gen's built in auditing and determined a way to do this?
Wayne E. Pfeffer
I have used LLBLGens Auditing classes. Determining the user is really something that you will have to handle. There are too many variables for LLBLGen to actually do this for you. How are your users handled? Is this a winforms or asp.net application?
The best solution would be to store the UserId in a session variable or static variable depending on which is more appropriate for your application. In your implementation of the Auditing class you can just pull the UserId from its storage place.
Another potential solution would be to override the Entity Class or the Data Adapter classes and pass the UserId in to your save methods. However, this would be a lot more work.
In my WinForms app, I accomplish this by creating a custom IPrincipal and stick that on System.Threading.Thread.CurrentPrincipal when a user logs into the application. Then, I can easily grab that from inside my LLBLGen auditing classes.
We're also about to implement auditing of changes to the db, and have the same issue of adding the user_id to the auditlog. I can see you can do the pull-approach, e.g. fetchingn the user_id from the web session (we're building a web application), but this would completely mess up the layering of the application, as I see it!?
I.e. if the DAL pulls data information from the presentation layer (web session), I won't be able to use the DAL in other contexts?
Best regards,
--thomas