Skip to content

Commit 9f10c4a

Browse files
committed
Added: recent settings list (load history).
Added: reset option for the template text. Added: toast notification for clearer status. Improved: load and save logic. Fixed: fixed cancel button. Fixed: issues.
1 parent 1c4221c commit 9f10c4a

15 files changed

Lines changed: 1290 additions & 245 deletions

README.md

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,36 @@
22

33
[![Join the chat at https://gitter.im/yagasoft/DynamicsCrm-TemplateBasedCodeGeneratorPlugin](https://badges.gitter.im/yagasoft/DynamicsCrm-TemplateBasedCodeGeneratorPlugin.svg)](https://gitter.im/yagasoft/DynamicsCrm-TemplateBasedCodeGeneratorPlugin?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
44

5-
### Version: 2.0.0.1
5+
### Version: 2.1.0.1
66
---
77

88
An XrmToolBox plugin that can be used to generate Early-bound code from a CRM Schema using a customisable T4 Template.
99

10+
## Features
11+
12+
+ Preserved the original CrmSvcUtil structure and logic.
13+
+ Customize the way the code is generated.
14+
+ You get a default T4 template for the code that is generated, with a multitude more features than the official tool (features below).
15+
+ You can rewrite the whole template if you wish for any possible requirements.
16+
+ Replaced the SDK types with .NET types.
17+
+ Generate only what's needed
18+
+ Only choose the entities required.
19+
+ Only the fields required.
20+
+ Additional control
21+
+ Option to use display names of entities and fields as variable names instead of logical names.
22+
+ Override field names inside the tool's UI.
23+
+ Ability to Lock variable names to avoid code errors on regeneration.
24+
+ Support for strongly-typed alternate keys, for entities and Entity References.
25+
+ Add annotations for model validation.
26+
+ Generate metadata.
27+
+ Field logical and schema names.
28+
+ Localised labels.
29+
+ Automatically limit attributes retrieved from CRM on any entity in a LINQ to the ones choosen (filtered) in the tool (check new entity constructors).
30+
+ Many options to optimise generated code size even further.
31+
+ Generate concrete classes for CRM Actions.
32+
+ Support bulk relation loading.
33+
+ Support filtering on relation loading.
34+
1035
## Usage
1136

1237
Install ([here](https://www.xrmtoolbox.com/plugins/plugininfo/?id=45abdb43-f0e5-ea11-bf21-281878877ebf)).
@@ -19,22 +44,19 @@ Install ([here](https://www.xrmtoolbox.com/plugins/plugininfo/?id=45abdb43-f0e5-
1944

2045
A more sophisticated Visual Studio Extension can be found at [VS Marketplace](https://marketplace.visualstudio.com/items?itemName=Yagasoft.CrmCodeGenerator).
2146

22-
The engine for this Plugin and the VS Extension is the same. The settings and T4 Templates can be used for both (with minor modification).
47+
The engine for this Plugin and the VS Extension is the same. The settings and T4 Templates can be used for both (with minor modifications).
2348

2449
You can read a quick overview of the tool and its functionality [here](http://blog.yagasoft.com/2020/09/dynamics-template-based-code-generator-supercharged).
2550

26-
## Credits
27-
28-
+ Base code:
29-
+ Eric Labashosky
30-
+ https://github.com/xairrick/CrmCodeGenerator
31-
+ My work:
32-
+ Completely reworked the screens
33-
+ Greatly enhanced the generation and regeneration speed
34-
+ Added the features that don't exist in the official tool
35-
3651
## Changes
3752

53+
#### _v2.1.0.1 (2020-09-28)_
54+
+ Added: recent settings list (load history)
55+
+ Added: reset option for the template text
56+
+ Added: toast notification for clearer status
57+
+ Improved: load and save logic
58+
+ Fixed: fixed cancel button
59+
+ Fixed: issues
3860
#### _v2.0.0.1 (2020-09-26)_
3961
+ Added: all missing features from VS extension (click on 'Quick Guide' for more info), except Contracts
4062
+ Added: keep track of paths (settings, template, and code) used in previous sessions and the links between them

TemplateCodeGeneratorPlugin/Control/DeletableMenuItem.Designer.cs

Lines changed: 114 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
#region Imports
2+
3+
using System;
4+
using System.Drawing;
5+
using System.Windows.Forms;
6+
7+
#endregion
8+
9+
namespace Yagasoft.TemplateCodeGeneratorPlugin.Control
10+
{
11+
public partial class DeletableMenuItem : UserControl
12+
{
13+
public delegate void DeletableMenuItemClickedEventHandler(object sender, MenuItemClickedEventArgs e);
14+
15+
public event DeletableMenuItemClickedEventHandler ItemClicked;
16+
public event DeletableMenuItemClickedEventHandler ItemDeleted;
17+
18+
protected virtual void OnClicked()
19+
{
20+
ItemClicked?.Invoke(this, new MenuItemClickedEventArgs(label, value));
21+
}
22+
23+
protected virtual void OnDeleted()
24+
{
25+
ItemDeleted?.Invoke(this, new MenuItemClickedEventArgs(label, value));
26+
}
27+
28+
public int LabelWidth => labelItem.Width;
29+
30+
private readonly object value;
31+
private readonly string label;
32+
private readonly bool isHighlight;
33+
private bool isChangeBorder;
34+
35+
public DeletableMenuItem(object value, string label, bool isHighlight = false)
36+
{
37+
this.value = value;
38+
this.label = label;
39+
this.isHighlight = isHighlight;
40+
41+
InitializeComponent();
42+
}
43+
44+
private void DeletableMenuItem_Load(object sender, EventArgs e)
45+
{
46+
labelItem.Text = label;
47+
48+
if (isHighlight)
49+
{
50+
labelItem.ForeColor = Color.Blue;
51+
}
52+
}
53+
54+
private void labelItem_Click(object sender, EventArgs e)
55+
{
56+
OnClicked();
57+
}
58+
59+
private void buttonDelete_Click(object sender, EventArgs e)
60+
{
61+
OnDeleted();
62+
}
63+
64+
private void labelItem_MouseEnter(object sender, EventArgs e)
65+
{
66+
labelItem.BackColor = Color.WhiteSmoke;
67+
isChangeBorder = true;
68+
}
69+
70+
private void labelItem_MouseLeave(object sender, EventArgs e)
71+
{
72+
labelItem.BackColor = Color.Transparent;
73+
isChangeBorder = false;
74+
}
75+
76+
private void labelItem_Paint(object sender, PaintEventArgs e)
77+
{
78+
const int width = 1;
79+
var colour = Color.DarkGray;
80+
81+
if (isChangeBorder)
82+
{
83+
ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle,
84+
colour, width, ButtonBorderStyle.Solid,
85+
colour, width, ButtonBorderStyle.Solid,
86+
colour, width, ButtonBorderStyle.Solid,
87+
colour, width, ButtonBorderStyle.Solid);
88+
}
89+
else
90+
{
91+
ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, BackColor, ButtonBorderStyle.Solid);
92+
}
93+
}
94+
}
95+
96+
public class MenuItemClickedEventArgs
97+
{
98+
public string Label { get; set; }
99+
public object Value { get; set; }
100+
101+
public MenuItemClickedEventArgs(string label, object value)
102+
{
103+
Label = label;
104+
Value = value;
105+
}
106+
}
107+
}

0 commit comments

Comments
 (0)