Generate Enums from Tables using Telerik OpenAccess - telerik-open-access

Reading the Telerik OpenAccess documentation, I see that I can set the data type of a Domain Class Property to an enumeration I have explicitly coded. Instead of coding them, can I use OpenAccess to generate (and maintain) enumeration types from my tables?

The Enum generation based on a database table is not supported out of the box by the Telerik OpenAccess ORM but after a short search in Google I found this Blog Post demonstrating how to achieve that by a standalone code generation template.
You could also add a feature request in the Ideas and Feedback portal of OpenAccess ORM for providing this functionality out of the box.

Related

Advantages of using custom classes in custom modules

Introduction
I'm designing an application using Kentico 11 CMS. Client provided me with this information:
Big data are expected
Versioning and workflow would be nice to have but are not mandatory
Editing interface for the data is needed
My research
Based on Kentico out of the box capabilities, I had to decide whether to use Pages, Module classes or Custom tables to store data. I've excluded Pages as they are not advised for big data by docs. After some additional reserach I consider Custom module to be the best option for me.
Documentation states that:
Custom modules: Workflow cannot be used for your data. Versioning of the stored data is not supported by default.
Question
1) Am I able to easily bypass this restriction when using custom classes for the custom module? (meaning versioning and workflow)
2) Is there any collision when defining an interface for editing the data, while using custom classes in custom modules?
3) When defining general indexes for searching will there be any problem when using custom classes in custom modules?
You can setup versioning (https://devnet.kentico.com/articles/module-development-versioning-recycle-bin), not workflow. If you need workflow just for publishing, first you can use pages appliaction, then after page is published move the content to custom class.
You can use default UI from Kentico or you can create your own.
I don't think so, but you can create always custom index if will be something wrong with general

What is the Recommended Approach for Hosting Transformations when creating a Custom Module?

In Kentico 11, in a custom module you are developing, when using a custom Page Template (portal mode) for the UI Element, where is the appropriate place to host Transformations used by web parts of that template? "Appropriate" meaning the transformations can be bundled with the module for import/export operations or at least grouped with it logically in Kentico admin?
The Kentico Custom Module app doesn't contain a Transformations tab for its Classes.
Repeater web parts used on the UI page template only list Custom Tables and Page Types when looking for transformations. Transformation doesn't seem to be supported for a Custom Class.
I could create a standalone container Page Type to host all transformations for the module, however this would be outside the module. These transformations would use data from Classes in the module (through repeater web parts and query data sources for example). It seems odd to put them outside so I am suspicious of doing this.
Up until now I've only used the out-of-box tab and listing web parts to create custom modules. Now I need to get into more customization, and prefer the portal mode to easily build templates using web parts. Transformations seem to be the missing consideration in this development flow.
Neither can I find Transformations mentioned in the Custom Module documentation. Kentico Documentation I'm referencing is:
Creating custom modules
Manually creating the interface for custom modules
Martin Hejtmanek's Module development articles like this one
I can find a place to put my transformations. I'm looking for thoughts about where to best put them and bundle them with my custom module work.
Your findings are a shortcoming in the module documentation. The documentation talks in great detail on how to build the module and display it within the Kentico UI but talks little to none on how to display that content outside of Kentico on the public facing website.
What you mentioned, using a custom Page Type as a container is a simple easy approach and I believe you can bundle this with your module. Yes it doesn't make sense but using this approach will allow you to have your custom queries to access the module data and display options (transformations).
You have another option to create custom webparts for this and package them with your module but I'd recommend against this because it takes away from the basic usage of Kentico and will require code maintenance and modifications for simple changes.
If you look at page types you will see that Kentico does the custom page types to hold transformations. They have ones like RSS Transformations, E-Commerce Transformations, etc.
That is the way I have always done it also.
I suggest you to take a look at the custom table module as example, i.e. user interface part of it: there is transformation menu item under edit custom table in the interface. Take a look on how it is done and try to clone/modify it for your own custom module. If you check the DB: cms_transformation table has TransformationClassID field. So transformation is attachable to a class - so you custom classes can have transformations attached. Honestly i've never done it, but this is the way how I would approach. I would keep apples with apples, oranges with oranges... yeah sure you can always create "container page type" and it will work, but i would play around with the custom module. You might need to create and extender in this case.
#John,
As per Brenden post, you can achieve this using custom web part with your custom logic.
Refer below URL:
https://docs.kentico.com/k10/developing-websites/defining-website-content-structure

SharePoint 2013 Document Organization

I'm trying to find a better way to organize a huge mass of documents on SharePoint 2013. I've done a lot of searching and I thought that Enterprise Metadata would be my solution but I have yet to find a good way to harness it. I fell like there must be a solution to what I need built into to SharePoint already.
I want to give each document a "tag" or Enterprise Metadata Keyword and then have a document library that only displays files that are associated with a specific keyword. Any ideas?
Thanks!
I'd suggest some built-in SharePoint document library features to consider to start with, before looking at any third-party offerings.
For a document library, (via the settings for the document library), you can enable Metadata Navigation Settings - this can allow a user to filter list items based on metadata fields. This may offer something along the lines of what you described. I'd advise caution for large lists though.
Another option would be to look at creating or amending views for the library - the options are found on the Library tab of the ribbon. You can setup some filtering or aggregration for the view.
There is also the option, if appropriate to make certain views only available at specific locations within the document library - set via the per-location view settings

VS 2012 EF 5 using .net 4 and database first Layered applications concepts

I upgraded from VS2005 to VS2012 specifically to code in .Net 4,.Net 4.5, and use EF5. I am new to EF. I have Julie's EF book but it talks mainly about EF4 and POCO and it has me confused trying to implement EF5.
My hosting only allows me to run .Net 4 currently. I am trying to use EF5 on a new database.
I tried Code first to generate my database but I could not get it to generate the database. So I created the database first and then generated the model from the database with EF5. What I want is a layered website using ASP.NET Forms, Data Access Layer, and a Business Layer. The business layer I intend to build so I can use ObjectDataSource to pull in to the webpage along with some web services to use cascading dropdowns.
I have my NameX.edm model created but the tt files don't have the same names, they have Model1.tt and Model1.Context.tt is not the same name, why. Also Model1.Context.tt is empty. I am attempting to create the POCO classes running the EF5 DbContext but I am having trouble getting it to see the edm model. I read somewhere that EF5 creates the POCO automatically. I am not seeing the big picture here. Is my issue that I am not using .Net4.5?
What I have is a ASP.NET Application project, a EF Project, a POCO Project, and intend to have a forth project with the Business logic. How do I get the EF generated correctly and the POCO classes? I want a layered application for to scale well. Next question How to get the POCO classes to talk with the Business logic? My database is SQL. I am use to writing stored proceedures to accomplish everything through business logic.
If you are using Model First technique, make sure that you have references to System.Data.Entity and System.Data.Entity.Design. Also, you will need to create a reference to the EntityFramework.dll as well. It is located by default in c:\Program Files\Microsoft ADO.NET Entity Framework Feature CTP5\Binaries\EntityFramework.dll. If you can not find it, make sure you have installed the Entity Framework through your Package Manager Console. To do this, open up Tools, Library Package Manager, Package Manager Console, then type Install-Package EntityFrameWork.
Next you want to add a new item to your project. Right click on your solution, go to Add, then select New Item. You want to select Data from the Common Items section on the left, then select ADO.NET Entity Data Model.
Next Select Generate From Database. In the next screen, if you have not set up your connection to the server, click New Connection..., otherwise select your database from the drop down box. You need to select whether or not you want to include your connection string information in your config file. This is up to you how secure you need your application to be. If you choose not to, you need to pass this information as parameters in code. Also at the bottom, you will most likely want to change the auto-generated entities name to something easier for you to use. This name will be the name of your DBContext Class!
Next you want to select the tables you would like EF to create POCO's for. If you want all the tables just tick the tables items. Same goes for views and stored procs.
Once you click finish, then you should see all your fancy POCOS laid out in front of you in Design Mode. Note If you do not have primary keys in place for all your tables, I suggest you fix that! VS will spit at you if you do not have Primary Keys set, or if your naming conventions in your tables prevent VS from creating them for you implicitly.
This is a quick little tutorial on getting you up and running. You can now persist and pull data from your POCOS by using your DBContext object. For example if you named your DBContext class *Gary_Bettman_Sucks*, and you wanted to create a new record from your table called NHL you would do the following:
Dim context as New Gary_Bettman_Sucks
Dim PullMyGoalie as New NHL With {
.Goals = 0,
.Playoffs = False
}
context.Set(Of NHL).Add(PullMyGoalie)
context.SaveChanges()
I would Highly suggest you look into implementing the Repository Pattern with your design to encourage code re-use, and it will seriously make your life MUCH easier down the road.
Hope this helps!

Sharepoint: Best way to display lists of non-Sharepoint content with "compatible" UI?

I've built a web part for Sharepoint that retrieves data from an external service. I'd like to display the items in a way that's UI-compatible with Sharepoint (fits in with its surroundings.)
I'm aware of the "DataFormWebPart" but was unable to get one working properly. It requires a valid DataSource and I was unable to build one from the results of a web service call... Part of the problem is that my web service wrappers don't expose the XML return info, rather I have a bunch of deserialized objects. There doesn't seem to be an easy way to turn actual objects into a datasource, or populate a "generic" datasource from object data.
I could use an SPGridView to get the same UI, but the grid control doesn't have much in the way of smarts -and- it forces every field into its own column. I'd prefer to render each list item as a single cell with complex rendering (for instance the way that StackOverflow shows its lists of questions.) I'd also like to get as much of the Sharepoint-standard UI as possible, such as the sorting, filtering, and paging controls.
So, first: Has anyone here written a Sharepoint control that does this, and if so do you have sample code to share? If not: am I overlooking some useful control, whether MS-supplied or available in an external library?
Thanks!
Steve
Sharepoint: Best way to display lists
of non-Sharepoint content with
“compatible” UI?
Take a look at the built in sharepoint web controls:
Microsoft.SharePoint.WebControls Namespace
It contains all the controls used in sharepoint. I'd tell you more, but the documentation is very thorough.
Problem with SharePoint is that there are a bunch of different ways to do this. If your data is not changing too often and is not overly large it may be worth considering entering it into a list for display.
If you have the Enterprise licence it may be worth getting your data into the BDC and using it there.
you may have to convert the objects into xml or use the serialised objects with the XML webpart for display. This still has the issue of custom rendering using XSLT.
Here's a great article that explains how to configure BDC connections to web services using the BDC Definition Editor:
Creating a Web Service Connection by Using the Business Data Catalog Definition Editor
http://msdn.microsoft.com/en-us/library/bb737887.aspx
The best way to do this IMO is to make a Web Part. As a Web Part the UI will be automatically rendered to be the same as the theme the site is using (unless you override it) and it will be able to be placed anywhere by anyone with admin privileges.
Tutorial on making a Web Part
Tutorial on packaging and deploying a Web Part
Example Web Part Source Code
You could create a custom web part and use an SPGridView. You say you don't like it, because it forces every field into its own column, but that's not true. You can create a template (ITemplate) for every column and fully customize what's shown inside it, just like you would using a normal ASP.Net GridView. Using this approach I've added the little "New" images right next to a list item's Title, just like SharePoint does itself.

Resources