Unfortunately, OpenAccess does not currently support out of the box manipulation of extended properties or other metadata fields. Thus I would offer you to vote for this feature request
, which would help us to eventually decide to implement such functionality based on the interest show towards it.
You can still work with extended properties by taking advantage of our context method for executing stored procedures
and SQL statements
in conjunction with the following stored procedures: sp_addextendedproperty
. In case you want to also retrieve extended properties, you could make use of the methods described in this MSDN article
. Note that this approach is considered a workaround and may prove inefficient in complex scenarios.
Please find attached a sample project which demonstrates adding, updating and removing extended properties via the aforementioned stored procedures. Retrieving the properties is achieved by using the table valued function fn_listextendedproperty.
The sample will create a simple database with a single table Customer: ID, Name, Email, DateCreated.
In order to deploy the sample you will have to:
- Extract the project.
- Open the solution in VisualStudio
- Upgrade OpenAccess references
- Add you connection string to the .config files in both projects - CustomerModel
- Change the value of the connectionStringName
variable with the name of your connection string. The variable is located in project CustomerModel
, file FluentModel
, class CustomerModelContext
- Select ManipulateExtendedProperties
as the start project
- Uncomment the methods according to the scenario you wish to explore
- Run the project in debug mode
Please note that when retrieving the properties, their SQL type is sql_variant and its respective C# CLR type is Object.
I hope this information was helpful to you. In case you have additional questions, do not hesitate to contact us again.
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvements shipped with this release.