How to add custom field to Asp Net Membership provider? - sql-server

I would like to add a string field "SerialNumber" in my User profile table in SQL with ASP Net membership provider. I can add field directly from the SQL Database but is that right to do it? I tried this article How to assign Profile values? but at the end it gives a compilation error which is Cannot convert type 'System.Web.Profile.ProfileBase' to 'ProfileCommon'.
Please help

you can use the Profile Provider for this.
Alternatively, you could create your own table(s) that store extra user-related data. But you have to create your own tables and creating the code to get and save data to and from these tables, so you can use custom tables in this way allows for greater flexibility and maintainability than the Profile Provider (specifically, the default Profile Provider, SqlProfileProvider, which stores profile data in an inefficient, denormalized manner).
Take a look at this tutorial

Related

snowflake - trigger/stream on the users view

I would like to create a stream on the user view to catch the changes but I am getting error: Change tracking is not supported on queries with joins of type '[LEFT_OUTER_JOIN]'.
I need to implement such case:
When a new user is created I want to create a schema in the database for that user.
Maybe you can suggest me some solution?

azure data factory - salesforce lookup

I am utilizing azure data factory upsert salesforce.
I have two tables in salesforce
contacts__c (holds the the individual first and last name )
contactdetails__c (holds additional information about contact)
since I can not use dataflows directly with salesforce (for lookup), I upsert contact__c (sourcesystemid__c hold our internal contact ID).
when trying upsert contactdetails__c, I have to perform a lookup on the fly to know the salesforce internal ID associated for each contact and use that to upsert contactdetails__c.
I saw article suggesting to use contact__r.sourcesystemid__c which doesn't work for me .
I use copy data activity for contactdetails with source being my data in azure sql (with our internal contact ID) and sink is contactdetails__c on the mapping of the contactID I use
source sink
contactid contact__r.sourcesystemid__c
but it doesn't work
would appreciate any suggestion as to how I can lookup internal id of contact while upserting contactdetails table
thanks
Your question is missing a lot of details. I do not know how you are trying to do this, but assuming you are using the REST API then take a look at the section named Upserting Records and Associating with an External ID of this document.
One question... Why are you using custom sObjects for this? Why not use the standard Contact sObject. Also having the data denormalized like you are indicating is a bad idea in Salesforce.

Dynamic data masking with Entity framework

Is it possible to use SQL's Dynamic data masking with Entity framework?
If it is possible, is there any way to combine it with Asp.Identity?
Project I'm working on requires that data is masked for certain user roles and visible to others.
We are using database first approach and Entity framework with data fields masked with:
MASKED WITH (FUNCTION = 'default()')
that need to be visible to admins and remain masked to other user roles. User roles are defined thru Asp.identity.
If it suits well your app architecture you can try approach from this blog post this blog post.
In two words you can create special db user which will represent your "other user roles". And then create two instances of DbContext: one for admin and one for the rest of your roles. So, basically, it's all about user identity provided in connection string.
Correct instance of DbContext with right connection string based on current user you can, for example, provide with dependency injection.

one authentification for different applications

I'm building four websites. They all should have the same login-datas (user can registrate on website 1 and also can use website 2 and 3 by using the same Login-Name).
My idea was to use the MS SQL Membershipprovider (good idea?).
Now I don't know where to place the SQL-Mebershipprovider (in an extra databse? or together with the websites? -> sound like getting chaos^^)
A other idea I've read was to create a webservice to the authentification?
But I think I'm getting problems with the data consitency, because I think there is no way to point from one database to an other (linking for example the usertable in database one to the texttable in databse 2).
I want to use MVC3 and a MS SQL-database.
Any experiences or ideas?
Thanks a lot!
You can use a separate membership database to do this and just point the providers of each site at this database.
If you wanted to use the role provider you would have to have the same roles in all four websites which may not be what you want. You could use a central database to just handle authentication and then create a local user record in each website that links back to your central user database (you will have to do this linking manually i.e. no relationship). This will then let you role your own role provider for each site.

Is there a way to persist user settings to a database in WPF

I'm exploring all the options to persist user settings. The artilce in the url User-specific settings files for a windows form application: local xml file or database convinced me to store the settings into a db as my application is a standalone communicating with a DB. Is there any provider class like RegistrySettingsProvider to persist the data into database.
No - there isn't anything directly comparable. I'd look at the user settings as just another kind of data to store in the database. Use the same methods to store the user settings as you do the rest of the application's data.
I recommend NHibernate for your data layer. Just set up a mapping file and the database table and let NHibernate handle persisting your data to the database. Use that for all your database storage throughout the app and see how little database code you need to write.
I afraid no because your use setting is very application specific and hence there is no general to do the persistence.
You might want to consider one of the following two approaches:
Serialize your user setting class as a string, and store that string as a blob text column in one of your table.
Create a table schema that maps to your user setting, and persist the setting according to each column.
I would prefer the first approach because of its flexibility.

Resources