Dotnetopenauth using Notes

Source: Internet
Author: User

First, we looked at some information:

Dotnetopenauth Source Https://github.com/DotNetOpenAuth/DotNetOpenAuth

Forever Seung-chul sharing experience and demo http://www.cnblogs.com/ljzforever/archive/2013/04/01/2985456.html

Wait until oneself use up still a lot of problems, now summarize as follows:

Environment: VisualStudio 2013,mysql Server 5.5,entityframework 6

Problem one: MySQL does not build foreign keys, Engin must be innodb to support foreign keys

Method One, modify the default My.ini, under [mysqld] Add
Default-storage-engine=innodb
Method Two, using SQL statements to modify the built-in table engine:
ALTER TABLE TableName TYPE=INNODB

Method Three, MySQL Workbench modified, my wokbench is V6.1:

Question two: Unable to add data entity model

The pop-up window asks "which version of the Entity Framework do you want to use?"

This article explains the use of EntityFramework6 to connect MySql database (db first mode) http://www.cnblogs.com/24la/p/ef6-mysql.html

Problem three: Not a problem, by the way to see the Modelfirst, add Entitydatamodel when you choose Emptymodel, and then add the entity inside, then modify the properties to generate SQL script

Problem three: Error safe transparent method "A" common sense access security critical type "B" failed. The assembly "C" is marked as AllowPartiallyTrustedCallersAttribute and is to be used with a Level 2 security transparency model ...

Download the source code, run a bit, and then copy the DLL to use, the feeling should be caused by this reason, and then install-package Dotnetopenauth such a reference to no error.

Question four: When running the error missing decryption key for the bucket "Https://localhost/dnoa/oauth_authorization_code" handle "Mfvy", Google a bit, said is "Https://localhost/dnoa/oauth_authorization_code" is fixed content, then look at buckets and handle

In the datasheet symmetriccryptokey, I think the table design is wrong.

The source code does not have the database design, the parameter is not transparent source code, then looks the garden friend's demo, has the database, is. db3 suffix, needs to install Shartplus Sqlit, the secret type and the length set wrong, set to Binnary 32 bit, no longer reported this wrong.

Question five: Error an exception of type ' System.Data.Entity.Validation.DbEntityValidationException ' occurred in EntityFramework.dll but is not handled in user code

Demo database comparison, found to be the nonce table, I set up a joint primary key, because from the demo Efmodel is the joint primary key, and the demo database table does not have a primary key, understand, it should be EF to the table without the primary key automatically generated joint primary key, so remove the database primary key, update Model from database, well, the Efmodel still show the joint primary key, prove the guess right!

But it's an error.

An error occurred while updating the entries. See the inner exception for details.
{"You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use-near ' (select\n ' nonce '). ' Context ' \ n ' nonce '. ' Code ', \ n ' nonce '. ' Timestamp ' \nfrom ' nonce ' as ' at line 1 '}

Google unable to add new entity with Context.savechanges () method. Original MySQL reason, EF connection MySQL, database table cannot have no primary key, added an auto-growing ID column as primary key, saved successfully.

Summing up, tossing so long, the basic database is the problem! Record it and hope to be useful to others.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.